Skip to content

Use opencode run per-prompt instead of non-existent stdin JSON prot… - #10

Merged
marchingphoenix merged 1 commit into
mainfrom
claude/fix-chat-opencode-connection-2JJ2Y
Feb 13, 2026
Merged

Use opencode run per-prompt instead of non-existent stdin JSON prot…#10
marchingphoenix merged 1 commit into
mainfrom
claude/fix-chat-opencode-connection-2JJ2Y

Conversation

@marchingphoenix

Copy link
Copy Markdown
Owner

The bridge was spawning opencode --format json as a long-running process and writing JSON commands to stdin. OpenCode does not support this protocol — prompts must be passed as CLI arguments via opencode run --format json -q "prompt".

Key changes:

  • start() now only validates the container and prepares the shell wrapper / environment. No process is spawned until sendPrompt().
  • sendPrompt() spawns a fresh opencode run process per prompt, passing the prompt text as a CLI argument with --format json -q.
  • Process exit with code 0 emits a "done" event (normal completion). Duplicate done events are suppressed if step_finish already fired.
  • Added NDJSON event mapping: OpenCode's step_start/step_finish/text events are normalised to our internal OpenCodeEvent schema.
  • Removed unused OpenCodeCommand type (stdin protocol removed).
  • isRunning() is now state-based (idle/busy) rather than requiring a live process, since processes are ephemeral.

https://claude.ai/code/session_01D12992HnEWn4Jh3iX9SFRe

…ocol

The bridge was spawning `opencode --format json` as a long-running
process and writing JSON commands to stdin.  OpenCode does not support
this protocol — prompts must be passed as CLI arguments via
`opencode run --format json -q "prompt"`.

Key changes:
- start() now only validates the container and prepares the shell
  wrapper / environment.  No process is spawned until sendPrompt().
- sendPrompt() spawns a fresh `opencode run` process per prompt,
  passing the prompt text as a CLI argument with --format json -q.
- Process exit with code 0 emits a "done" event (normal completion).
  Duplicate done events are suppressed if step_finish already fired.
- Added NDJSON event mapping: OpenCode's step_start/step_finish/text
  events are normalised to our internal OpenCodeEvent schema.
- Removed unused OpenCodeCommand type (stdin protocol removed).
- isRunning() is now state-based (idle/busy) rather than requiring a
  live process, since processes are ephemeral.

https://claude.ai/code/session_01D12992HnEWn4Jh3iX9SFRe
@marchingphoenix
marchingphoenix merged commit 36d5316 into main Feb 13, 2026
4 checks passed
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.

2 participants