Summary
Cyrus does not currently parse OpenCode usage, cost and finish-reason information from the event fields where OpenCode emits them.
Current behavior
Cyrus reads these values from the top level of a step_finish event.
OpenCode's current event shape places them inside step_finish.part, causing Cyrus to record missing or inaccurate session accounting.
Expected behavior
Cyrus should parse the current OpenCode event shape and record usage, cost and finish reason accurately.
Why this matters
Incorrect accounting makes OpenCode sessions harder to observe and can produce inaccurate usage and cost reporting.
Acceptance criteria
- Usage is read from the current
step_finish.part fields.
- Cost is recorded accurately.
- The actual finish reason is preserved.
- Missing optional values are handled safely.
- A single event is not counted more than once.
- Top-level fields can remain as a backwards-compatible fallback if needed.
- Test fixtures reflect real OpenCode JSON output.
Validation
Add tests using a representative real OpenCode step_finish event.
The tests should cover:
- Successful completion.
- Interrupted or stopped completion.
- Usage and cost values.
- Cache-token values where present.
- Missing optional fields.
- Protection against duplicate accounting.
Include a live smoke test showing that a completed OpenCode session records non-empty usage and the correct finish reason.
Related
Identified while validating #1263.
Observed on main at b936752.
Summary
Cyrus does not currently parse OpenCode usage, cost and finish-reason information from the event fields where OpenCode emits them.
Current behavior
Cyrus reads these values from the top level of a
step_finishevent.OpenCode's current event shape places them inside
step_finish.part, causing Cyrus to record missing or inaccurate session accounting.Expected behavior
Cyrus should parse the current OpenCode event shape and record usage, cost and finish reason accurately.
Why this matters
Incorrect accounting makes OpenCode sessions harder to observe and can produce inaccurate usage and cost reporting.
Acceptance criteria
step_finish.partfields.Validation
Add tests using a representative real OpenCode
step_finishevent.The tests should cover:
Include a live smoke test showing that a completed OpenCode session records non-empty usage and the correct finish reason.
Related
Identified while validating #1263.
Observed on
mainatb936752.