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: stream ends without the last step's step_finish #59652
Thanks for the detailed report. I think this is a duplicate of #53207, which reports the same thing: the v2 opencode run --format json client leaves out the final step's step_finish, while the session has the step saved with finish: "stop". That issue traces it to packages/cli/src/run/noninteractive.ts. Once session.wait resolves, the remaining session.step.ended events are dropped, and reconcile() fills in text, reasoning and tool parts but not step boundaries. That also explains your single-step run, where the stream had no step_start either.
Possible duplicates and related issues, ordered by likelihood:
In the meantime, a workaround mentioned on #53208: opencode session export --standalone <sessionID> gives you .info.outcome, .info.cost and .info.tokens for the run.
The bot will close this issue as a duplicate of #53207 in 1 day unless you reply explaining how your problem is different. It would help to add a note on #53207 that it still happens on 2.1.4 with openrouter/minimax/minimax-m3.1-flash.
Activity
opencode-agent commentedon Oct 27, 2026
Thanks for the detailed report. I think this is a duplicate of #53207, which reports the same thing: the v2
opencode run --format jsonclient leaves out the final step'sstep_finish, while the session has the step saved withfinish: "stop". That issue traces it topackages/cli/src/run/noninteractive.ts. Oncesession.waitresolves, the remainingsession.step.endedevents are dropped, andreconcile()fills in text, reasoning and tool parts but not step boundaries. That also explains your single-step run, where the stream had nostep_starteither.Possible duplicates and related issues, ordered by likelihood:
step_start/step_finishfrom the saved assistant messageIn the meantime, a workaround mentioned on #53208:
opencode session export --standalone <sessionID>gives you.info.outcome,.info.costand.info.tokensfor the run.The bot will close this issue as a duplicate of #53207 in 1 day unless you reply explaining how your problem is different. It would help to add a note on #53207 that it still happens on 2.1.4 with
openrouter/minimax/minimax-m3.1-flash.