Repository navigation
Conversation
`opencode run --format json` settles on `session.wait` and then ignores queued live events, reconciling text, reasoning, and tools from the projected messages. Step boundaries were not reconciled, so when idle won the race the final `step_finish` (with tokens and cost) and sometimes its `step_start` were never printed. Reconcile missing `step_start` and `step_finish` from the projected assistant message, skipping steps already emitted live and failed steps.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
Tested against real runs: the PR head vs. the same tree with only the
Default format output is unchanged and |
|
Downstream consumer here — Reproduced on We're bridging locally with a wrapper that appends one synthetic |
|
For the zero-usage problem in the meantime: the session itself has the real numbers. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #53207
Type of change
What does this PR do?
opencode runsettles onsession.wait. After that it ignores queued live events and fills in text, reasoning and tool parts from the saved messages inreconcile(). Step boundaries weren't filled in, so when idle arrived before the finalsession.step.ended, the finalstep_finish(with tokens and cost) was never printed. Sometimes itsstep_startwas lost too.The fix tracks which steps were already printed from live events.
reconcile()then prints any missingstep_start/step_finishfrom the saved assistant message:finish,snapshot,costandtokens. Failed steps (saved with anerror) still only print the error, as on the live path.How did you verify your code works?
step_finishbun test test/runandbun run checkpass.deepseek-v4-flash,glm-5.3-flash): 0/9 runs had the finalstep_finishbefore this change, 20/20 after, with no duplicates.Screenshots / recordings
N/A, CLI output only.
Checklist