Two races found by running the schema test repeatedly:
- The streamed view ended its model step only after the engine had read
the final piece. The engine could add the reply and end the turn first,
and the turn's end then closed the step as interrupted, without its
usage or finish reason. The step now ends when the final piece
arrives, before the engine sees it.
- A shadow check runs in the background and can outlast the turn's last
event. The turn's end is now recorded with the time of its ending
event but sent once running shadow checks finish (at most 30 s), so
their steps are not closed as interrupted while they run.
Also: a server test's fake provider answers the session title apart, so
the title call can no longer take the turn's only reply.
Phase 1 engine item E1 (ocw-context docs/observability/phase-1/
technical-design.md §4, §5.3, §10).
- run, retry and resume send turn_started at TURN_START and turn_ended
at TURN_END, INTERRUPTED or ERROR; a turn that ends with none of
these (an abandoned generator, a resume stopped mid-tools) is closed
as interrupted after Stop, else unknown. A retry's start waits for
the first message it adds, so it can carry that message's mid.
- Callers pass trigger= (user, channel, schedule, team_wake); anything
that does not say is recorded as unknown.
- Every call that runs is a tool step from _execute_sync to its raw
result, with its call id, position in the reply, result message mid,
risk class, result size and exit code. A call that never ran is a
zero-length step with its status (error, denied, interrupted,
skipped).
- While recording, UI events carry turn_id and ts_ms, and tool events
their tool_call_id and step_id. Six TOOL_FINISHED events and both
TOOL_STARTED events now carry tool_call_id.
- The server gives every engine it builds its recorder, so real turns
are saved in recordings.db.