Skip to content

fix(opencode): OpenChamber submit_plan hang#1004

Draft
basicsharp wants to merge 1 commit into
backnotprop:mainfrom
basicsharp:openchamber-plannotator-detached-submit-plan
Draft

fix(opencode): OpenChamber submit_plan hang#1004
basicsharp wants to merge 1 commit into
backnotprop:mainfrom
basicsharp:openchamber-plannotator-detached-submit-plan

Conversation

@basicsharp

@basicsharp basicsharp commented Jul 6, 2026

Copy link
Copy Markdown

Issue background

OpenChamber runs the OpenCode server inside the desktop app process and marks that environment with OPENCHAMBER_RUNTIME. In that host, a long-running submit_plan tool call is a poor fit: OpenChamber keeps the tool part in a running state while Plannotator waits for the user to approve or comment in the browser UI.

This was observed with @plannotator/opencode in OpenChamber: the plan backing file was written successfully and the Plannotator UI could be launched, but the OpenChamber chat stayed stuck around the submit_plan tool call. The same flow worked from the normal OpenCode CLI because the CLI can tolerate the blocking approval flow.

The first attempted workaround was to return the review URL immediately from OpenChamber mode. That fixed the visible hang, but it also broke the plan-review gate: OpenChamber no longer waited for the eventual approval, denial comments, or helper failure. This PR keeps the immediate URL return while preserving the review result path.

Summary

  • Detect OpenChamber-managed OpenCode via OPENCHAMBER_RUNTIME in the OpenCode plugin
  • Launch Plannotator plan review through a background CLI helper and return the review URL immediately
  • Keep stdout/stderr listeners alive so approval, denial comments, or helper errors are sent back into the OpenCode session
  • Keep normal OpenCode CLI behavior on the existing blocking approval path

Behavior after this change

  • OpenChamber users see the Plannotator review URL immediately instead of a permanently running tool call
  • Agents are told not to continue implementation until Plannotator sends the approval/comments back into the session
  • Approval still triggers the existing approved-plan prompt and optional agent switch
  • Denial/comments still return the line-numbered plan so the agent can call submit_plan again with targeted edits
  • OpenCode CLI users continue to use the existing blocking submit_plan behavior

Validation

  • bun test apps/opencode-plugin/cli-bridge.test.ts apps/opencode-plugin/submit-plan.test.ts apps/opencode-plugin/workflow.test.ts
  • bun run build:review
  • bun run build:hook
  • bun run build:opencode
  • bun run typecheck
  • Explicit tsc checks via bun x tsc for packages/shared, packages/ai, packages/server, packages/ui, and apps/pi-extension
  • node --check apps/opencode-plugin/dist/index.js

@basicsharp basicsharp force-pushed the openchamber-plannotator-detached-submit-plan branch from 64116ce to e75be92 Compare July 7, 2026 10:57
@basicsharp basicsharp changed the title Fix OpenChamber submit_plan hang fix(opencode): OpenChamber submit_plan hang Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant