Skip to content

Record each reply when it ends, and unfinished ones - #3

Merged
charlesnutter merged 2 commits into
mainfrom
turn-boundaries
Sep 25, 2026
Merged

charlesnutter merged 2 commits into
mainfrom
turn-boundaries

Conversation

@charlesnutter

Copy link
Copy Markdown
Owner

Record each reply when it ends, and show interrupted or failed ones. Ships as 0.3.2.

Problem

Turns were only recorded on session.execution.succeeded. A message sent while a reply is running is queued into the same execution, so the first reply was never recorded; and an execution that ends interrupted or failed recorded nothing. A 19m 53s reply left the previous turn in the sidebar.

What changes

  • Reply end: a step ending stop, length or content-filter reports its reply, bounded at that step so a queued message after it is excluded. Not error/unknown, since OpenCode retries steps under the same message id. Each reply reports once (deduped by its last step).
  • Queued reply timing: starts when the previous reply in the execution ended, or when the message was sent if later.
  • Interrupted / failed: session.execution.interrupted and .failed report the unfinished reply with OpenCode's figures and an interrupted / failed note; engine reading skipped. OpenCode records no tokens for the stopped step, so a 0 count hides the tokens and speed rows, and unfinished replies are excluded from session speed, trend and time split. History marks the row.

Verified live (MTPLX, OpenCode 2.0.12)

  • Queued message: reply 1 reported at its end (4,068 tok, 126.95s) while the execution continued; the queued reply reported at execution end (4,905 tok, 144.81s). Each once.
  • Interrupted after 7s: shown marked interrupted.
  • At step end + 50ms the message already had its time and tokens.

Note

The queued reply's time (144.81s) differs from OpenCode's label (4m 31s) by design: OpenCode includes the wait behind the previous reply, which would otherwise be counted in both replies.

@charlesnutter
charlesnutter merged commit 35ff56e into main Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant