feat(output): emit turn_start event on JSONL stream#217
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
JsonStreamSink::on_turn_start only updated internal state, never
emitting a line. Consumers of the JSONL stream could see TurnComplete
arrive at the end of a turn but had no signal that a new turn had
begun — so a real-time progress indicator ("turn 3 of 10, still
working...") couldn't render without racing a TextDelta or ToolCall
event.
Adds Event::TurnStart { turn } with a minimal envelope (only type +
turn). The event fires immediately after the internal turn counter is
updated, so the line carries the new turn number and consumers
can correlate it with the matching TurnComplete bookend.
Stderr is unchanged; this is purely additive on stdout.
Two new tests cover: snake_case type tag + turn field shape, and an
envelope-size guard that will fail if a future refactor accidentally
adds model/session fields to TurnStart (consumers snapshot envelope
shapes). The existing all_events_are_single_line_json check is
extended to include TurnStart.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`JsonStreamSink::on_turn_start` only updated an internal counter — it never emitted a JSONL line. Consumers of the stream saw `turn_complete` arrive at the end of each turn but had no signal that a new turn had begun, so a real-time progress renderer ("turn 3 of 10, still working...") couldn't draw without racing the first `text_delta` or `tool_call`.
This PR adds a `turn_start` event — a minimal envelope with just `type` and `turn` — emitted immediately after the internal counter is updated. It's the matching bookend to `turn_complete`. Stderr is unchanged; this is purely additive on stdout.
Test plan