- Turns left open are closed when the server holds the engine lock, checked
inside build_app, whose signature stays as it was (test_server stubs it).
- A model step starts with the catalogue's window only; the user's saved size
or Ollama's num_ctx is filled in when the call ends, so recording never
delays the request (a title call raced ahead of the main call in
test_server).
- Turns left open by a crash or restart are closed at start as unknown, with a
recording_gap notice (TD-12), only by the process that holds the engine lock.
- Steps closed without their own end keep their kind's fields as "not known";
interactive tools get an empty decision path.
- A Stop at a card, or one that kills a running command, is interrupted, not
denied or ok.
- The skills menu is the one the turn offered; a skill turned off leaves it.
- Model steps carry the window the engine compacts against (saved size,
Ollama num_ctx), so local models show the context.
- Decision-model checks record each question's answer; a session grant set
aside in Auto-approve is in the decision path.
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 E23 (ocw-context
docs/observability/phase-1/technical-design.md §5.5, §8.1, TD-16).
OpenAI Decisions and TypeSafe Jev call their own service, not the
provider router. DecisionReviewer.review takes the check's view and
records the request through ProviderView.record_call: a model step
nested in the auto-approver check, purpose auto_approver, provider
openai_decisions or typesafe_jev, with the exchange, provider_meta and
provider_facts from the HTTP capture, and usage read from the service's
reply (the shared usage vectors for both services pass).
Not yet: the per-question answers in the check's content, and score and
cutoff.
Phase 1 engine items E15a, E16, E5 and E13 (ocw-context
docs/observability/phase-1/technical-design.md §5.6, §5.8, §9).
E15a: every turn's stamp has the machine (this machine, own machine or
cloud, from remote.json; id, name, app version, never 0.0.0), the model
and its provider, and the sandbox (provider, enforcement, profile).
E16: the session build computes the coworker fingerprint from its id,
its instructions and its own skill files; it is on every turn's stamp.
E5: a context step at the turn's first model call: session prompt hash,
per-turn block size and hash, mode note, folders, and on the session's
first turn the memories, memory mode, rules and AGENTS.md counts. A
change of the per-turn block mid-turn is a context_changed notice.
Error, interrupted, reviewer_paused, step_limit and truncated are
zero-length notice steps.
E13: network_note keeps per-site counts, first times and the late flag
(V-04) in a private key the engine takes out of the result before the
model sees it; the tool step gets attrs.sandbox (blocked_known,
blocked_count) and the sites in content.
Known gaps: skills_menu and skills_hash are not read yet, and the
fingerprint hashes the coworker's instructions text rather than its
manifest file.
Phase 1 engine items E2, E22 and E3 (ocw-context
docs/observability/phase-1/technical-design.md §3.3, §5.2, §5.2.1, §6).
E2: the provider router is wrapped once in a RecordingProvider; each
caller holds a tagged view (main in the engine, summary, auto_approver,
title, proxy). Each call is a model step with purpose, provider, model,
tool count and hash, time to first streamed piece, finish reason and
usage. A main call's step points at the reply message's mid; a title
tagged with a turn that already ended is after_turn; an untagged call is
recorded as unattributed. Errors get error.type from the root cause.
E22: requests are captured below the SDKs, at httpx's HTTPTransport,
only while a recorded call is reading on its own thread. Each step keeps
the exact exchange (request as a manifest of SHA-256 pieces, response
body as one piece), provider_meta without content or secrets, and
provider_facts with fixed names.
E3: TokenUsage carries reasoning and whether cache counts were sent, so
a count not sent is recorded as unknown, never 0. Cache writes are read
where sent and taken out of fresh input on OpenAI-style wires; Ollama's
cached prompt count is used; Anthropic streams take the final
message_delta totals. The shared usage vectors pass through each
provider's own code.
Also fixes the store's usage_reported column for usage {"reported": false}.