Repository navigation
Description
Summary
In ORPT-Bench we found that opencode export <sessionID> --pure is not reliable enough to use as the source of truth for session cost accounting.
For at least one reproduced session, the live OpenCode SQLite message table retained the full assistant message ledger with per-message cost values, while opencode export --pure for the same live session failed with truncated output (parse error: Unfinished string at EOF). In earlier benchmark runs, we also observed materially undercounted session totals when relying on export-derived message costs.
This is a billing-integrity problem, not just a display problem.
Why this matters
ORPT-Bench uses actual observed cost as a first-class scoring input. If export undercounts or becomes unparsable on larger sessions, any downstream benchmarking, reporting, or spend controls built on top of export can be wrong by a meaningful amount.
Repro evidence
Fresh reproduced session inside the runner container:
- Session ID:
ses_28baacfedffeeTgtD3rTkPB8Gx - Title:
08-workspace-transplant-bundle-repair:opencode/gpt-5.4-nano
Querying the live SQLite message ledger through opencode db shows many assistant rows with nontrivial data.cost values for this single session, for example:
0.002133220.000697460.000741610.000674610.000835440.000963570.001744750.00242191- and more
Summing those assistant message costs for the session yields:
0.01513360
The session has no parent session (parent_id = null), so this is not a parent/child session accounting confusion.
But exporting the exact same live session via:
opencode export ses_28baacfedffeeTgtD3rTkPB8Gx --purethen parsing with jq failed with:
parse error: Unfinished string at EOF
So the export stream for this live session was not even parseable as complete JSON.
Expected behavior
One of these needs to be true:
opencode export --pureshould return a complete, parseable session payload for long sessions.- The exported payload should preserve the full billed assistant message ledger used internally.
- There should be a documented supported way to retrieve exact billed session/message costs safely for automation.
Actual behavior
- The live message ledger contains assistant
costvalues. opencode export --purecan fail or produce output that is not safe to treat as a billing ledger.- Downstream tooling can materially undercount spend if it trusts export alone.
Downstream mitigation
As a mitigation, we are switching our benchmark harness to read exact assistant message costs directly from the live OpenCode SQLite message ledger for the target session, and using export only as a fallback/debug source.
Activity
github-actions commentedon Apr 9, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
opencode exportoutputs truncated/unparseable JSON (parse error: Unfinished string at EOF) for large sessions when pipedopencode exportis unreliable for long sessions (wrong message order)If you believe this was flagged incorrectly, please let a maintainer know.