You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
run --format json: final step_finish is missing #54661
With opencode v2.0.26 (9b4ec57) on Linux x86_64, --standalone, model deepseek/deepseek-v4-flash, successful --format json runs never print a step_finish for the final step.
Repro
cd"$(mktemp -d "$HOME/oc-json.XXXXXX")"&& git init -q
opencode run --standalone --format json --model deepseek/deepseek-v4-flash "Reply with exactly: OK"echo"exit=$?"
Same in 8/8 JSON runs: two plain replies and six runs with file reads. Runs that call tools print step_finish (reason tool-calls) for every intermediate step, but not for the final one; every stream ends on text.
Expected
The final step's step_finish, with its finish reason, tokens and cost. Those fields are currently missing from stdout for the last step, which is the only step in a plain reply.
Possible cause
From reading packages/cli/src/run/noninteractive.ts (not an instrumented trace): once session.wait resolves, finalizing is set and output is reconciled; from then on the consumer skips every event that is not session.execution.*, including session.step.ended, and reconciliation does not restore step_finish. The subscription is then aborted without draining pending events.
Background: #36413 and #50341 were closed in the V1 freeze with a request to retest on V2. The original empty-stdout symptom did not reproduce on 2.0.26; this report is only about the missing final step_finish.
Thanks for the clear report and for retesting on v2. I think this is a duplicate of #53207, which reports the same missing final step_finish in the v2 opencode run --format json client and points to the same cause in packages/cli/src/run/noninteractive.ts: once session.wait resolves and finalizing is set, events other than session.execution.* are skipped, and reconcile() doesn't rebuild step_finish.
Possible duplicates and related issues, ordered by likelihood:
It would help to add to #53207 that this still happens on 2.0.26 on Linux with deepseek/deepseek-v4-flash. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
We haven't heard back, so we're closing this as a duplicate of #53207. That issue covers the same missing final step_finish from opencode run --format json in the v2 client, with the same suspected cause in noninteractive.ts. Please follow #53207 for updates. If you can, add a note there that it still happens on 2.0.26 on Linux with deepseek/deepseek-v4-flash. If your problem turns out to be different, reply here and we'll take another look. Thanks for the detailed report!
Activity
opencode-agent commentedon Oct 12, 2026
Thanks for the clear report and for retesting on v2. I think this is a duplicate of #53207, which reports the same missing final
step_finishin the v2opencode run --format jsonclient and points to the same cause inpackages/cli/src/run/noninteractive.ts: oncesession.waitresolves andfinalizingis set, events other thansession.execution.*are skipped, andreconcile()doesn't rebuildstep_finish.Possible duplicates and related issues, ordered by likelihood:
step_finishdropped in plain and tool-call runs), reported on v2.0.22 and still openopencode run --format=jsonemits terminalstep_finishbut never exits #44901: related, closed: the finalstep_finishwas printed but the process never exitedIt would help to add to #53207 that this still happens on 2.0.26 on Linux with
deepseek/deepseek-v4-flash. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.opencode-agent commentedon Oct 13, 2026
We haven't heard back, so we're closing this as a duplicate of #53207. That issue covers the same missing final
step_finishfromopencode run --format jsonin the v2 client, with the same suspected cause innoninteractive.ts. Please follow #53207 for updates. If you can, add a note there that it still happens on 2.0.26 on Linux withdeepseek/deepseek-v4-flash. If your problem turns out to be different, reply here and we'll take another look. Thanks for the detailed report!