Python
feat(observability): recorder, recordings.db store and stable message ids (OPE-244)
Devika Vermae51bc1cc23c9
diff --git a/coworker/engine.py b/coworker/engine.pyindex 716c262b..6effd282 100644--- a/coworker/engine.py+++ b/coworker/engine.py@@ -33,6 +33,7 @@ from . import toolchain as _toolchainfrom . import toolresultfrom . import unattended as _attendancefrom .events import Event, EventType+from .observability.ids import new_ulid# §8.4 retry guard: the reviewer pauses for the rest of the turn after this many denials# IN A ROW (2→5 + streak semantics, owner ruling 2026-08-24 — a cumulative 2 silently@@ -437,7 +438,7 @@ class TurnEngine:if instructions and not (self.messages and self.messages[0].get("role") == "system"):- self.messages.insert(0, {"role": "system", "content": instructions})+ self._add_message({"role": "system", "content": instructions}, at=0)self._cancel = asyncio.Event()# Whether the latest assistant turn hit the output-token limit — decides which# diagnosis a mangled (unparseable-args) tool call gets answered with.@@ -490,6 +491,19 @@ class TurnEngine:finally:self._tool_timings.setdefault(tool_call.id, {}).update(waited_started=started, waited_ms=(time.monotonic() - clock) * 1000)+ def _add_message(self, message: dict[str, Any], *, at: Optional[int] = None) -> None:+ """Append (or, with `at`, insert) one message into the history, stamping its `mid`.++ `mid` is a ULID that never changes, so a recorded step can point at the message it+ produced even after a stub is inserted mid-history or the file is rewritten+ (observability E21). It is a sidecar like `ts`: stripped before any provider sees it.+ """+ message.setdefault("mid", new_ulid())+ if at is None:+ self.messages.append(message)+ else:+ self.messages.insert(at, message)+def _timed_result(self, tool_call, result):message = _tool_result_message(tool_call, result)if tool_call.id in self._tool_timings:@@ -536,7 +550,7 @@ class TurnEngine:message["_display"] = displayif activity:message["_activity"] = activity- self.messages.append(message)+ self._add_message(message)self._cancel.clear()if not self._dangerous_warned:if self.permissions.mode is Mode.DANGEROUSLY_BYPASS_APPROVALS:@@ -638,7 +652,7 @@ class TurnEngine:if text:notice["text"] = textnotice.update({k: v for k, v in fields.items() if v is not None})- self.messages.append(notice)+ self._add_message(notice)@_summarizes_turnasync def retry(self) -> AsyncIterator[Event]:@@ -735,7 +749,7 @@ class TurnEngine:})for offset, stub in enumerate(stubs, start=1):- self.messages.insert(i + offset, stub)+ self._add_message(stub, at=i + offset)i += 1 + len(stubs)def _unanswered_trailing_tool_calls(self) -> list[ToolCall]:@@ -835,7 +849,7 @@ class TurnEngine:# Same contract as the stop path below: the partial the user watched# arrive survives the failure.if streamed or streamed_reasoning:- self.messages.append(_assistant_message(_partial_turn()))+ self._add_message(_assistant_message(_partial_turn()))friendly = friendly_model_error(self.model, exc)payload = {"error": friendly or str(exc),@@ -849,7 +863,7 @@ class TurnEngine:if self._cancel.is_set() and turn is None:# Stopped mid-stream: persist exactly what the user watched arrive.if streamed or streamed_reasoning:- self.messages.append(_assistant_message(_partial_turn()))+ self._add_message(_assistant_message(_partial_turn()))self._append_notice("interrupted")yield Event(EventType.INTERRUPTED, {"iterations": iterations})return@@ -872,7 +886,7 @@ class TurnEngine:cleaned, self.registry.schemas() or None):turn.text = cleaned- self.messages.append(+ self._add_message(_assistant_message(turn,model=self.model,@@ -916,7 +930,7 @@ class TurnEngine:cut["replay"] = "stub"if self._continuations < MAX_TRUNCATION_CONTINUATIONS:self._continuations += 1- self.messages.append(+ self._add_message({"role": "user","content": TRUNCATION_NUDGE,@@ -1369,7 +1383,7 @@ class TurnEngine:"received nothing. `_raw` is not a parameter — it is the unparsed text of ""the failed call. Re-issue the call using the tool's declared parameters.")- self.messages.append(_tool_error_message(tool_call, reason))+ self._add_message(_tool_error_message(tool_call, reason))self._audit(tool_call, stage="finished", status="error", reason=reason)return Event(EventType.TOOL_FINISHED,@@ -1380,7 +1394,7 @@ class TurnEngine:"""The stop-path answer for a call that will not run: a tool-error result in thehistory (hosted chat templates reject orphaned tool_calls, and durable-resumewould otherwise re-prompt it) + the finished event for the tool card."""- self.messages.append(_tool_error_message(tool_call, "interrupted by user"))+ self._add_message(_tool_error_message(tool_call, "interrupted by user"))self._audit(tool_call, stage="finished", status="interrupted", reason="user stop")@@ -2000,7 +2014,7 @@ class TurnEngine:"approval_origin": "reviewer_denied",**({"approval_note": card_note} if card_note else {}),}- self.messages.append(deny_msg)+ self._add_message(deny_msg)self._audit(tool_call,stage="finished",@@ -2142,7 +2156,7 @@ class TurnEngine:"reason": "The worker request was already resolved. No further action was taken.",}self._approval_origins.pop(tool_call.id, None)- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call, stage="approval_resolved", call_id=tool_call.id, status="superseded", reason=result["reason"])self._audit(tool_call, stage="finished", status="skipped", reason=result["reason"])yield Event(EventType.TOOL_FINISHED, {@@ -2238,7 +2252,7 @@ class TurnEngine:**({"approval_note": origin["note"]} if origin.get("note") else {}),**({"approval_grant": origin["grant"]} if origin.get("grant") else {}),}- self.messages.append(err_msg)+ self._add_message(err_msg)yield Event(EventType.TOOL_FINISHED,{"name": tool_call.name, "status": "denied", "reason": reason},@@ -2248,7 +2262,7 @@ class TurnEngine:returnif spec is None:- self.messages.append(+ self._add_message(_tool_error_message(tool_call, f"unknown tool: {tool_call.name}"))yield Event(@@ -2379,7 +2393,7 @@ class TurnEngine:if self._tool_result_spill_dir is not None:for spilled in self._tool_result_spill_dir.glob(f"{self._step:04d}-*"):self._agent_files.mark_outside(spilled)- self.messages.append(message)+ self._add_message(message)hidden = int((display or {}).get("hidden_by_filters") or 0)stripped = int((display or {}).get("hidden_fields") or 0)if hidden or stripped:@@ -2514,7 +2528,7 @@ class TurnEngine:) or {"approved": False, "error": "no response"}status = "ok" if result.get("approved") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -2566,7 +2580,7 @@ class TurnEngine:"The user declined. Carry on without it and say plainly what you could not do.",)status = "ok" if result.get("approved") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call, stage="finished", status=status, result=result, result_preview=_preview(result))yield Event(EventType.TOOL_FINISHED,@@ -2622,7 +2636,7 @@ class TurnEngine:if result.get("approved") and result.get("team_id"):created = {"team_id": result["team_id"], "workers": result.get("workers") or []}message["_display"] = {"team_created": created}- self.messages.append(message)+ self._add_message(message)self._audit(tool_call,stage="finished",@@ -2695,7 +2709,7 @@ class TurnEngine:}status = "ok" if result.get("approved") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -2770,7 +2784,7 @@ class TurnEngine:}status = "ok" if result.get("approved") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -2889,7 +2903,7 @@ class TurnEngine:)status = "ok" if result.get("installed") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -2984,7 +2998,7 @@ class TurnEngine:}status = "ok" if result.get("granted") else "denied"- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -3065,7 +3079,7 @@ class TurnEngine:)if status == "ok":self._note_ask_replies(result, question)- self.messages.append(self._timed_result(tool_call, result))+ self._add_message(self._timed_result(tool_call, result))self._audit(tool_call,stage="finished",@@ -3121,14 +3135,14 @@ class TurnEngine:message["source"] = sourceif activity:message["_activity"] = activity- self.messages.append(message)+ self._add_message(message)self._steering = []def _outbound_messages(self) -> list[dict[str, Any]]:"""`self.messages` prepared for the provider. The SOLE provider feed (see `_astream`).- Every message is stripped of the display-only sidecars — `source`, `_display`, and- `ts` — (providers reject unknown keys), unconditionally — whether or not a+ Every message is stripped of the display-only sidecars — `source`, `_display`, `ts`+ and `mid` — (providers reject unknown keys), unconditionally — whether or not a`<system-context>` block is added. When a contextprovider yields a non-empty string, an ephemeral `<system-context>` block is appended to thelast user message. A partial assistant turn abandoned by a turn that died mid-stream —@@ -3137,7 +3151,7 @@ class TurnEngine:Never mutates `self.messages`, so none of this is persisted/replayed."""# Strip the display-only sidecars — `source` (connector cards), `_display`- # (e.g. filter-hidden counts), `ts` (append-time timestamps), `reasoning`+ # (e.g. filter-hidden counts), `ts` (append-time timestamps), `mid` (stable message ids), `reasoning`# (thinking text), `usage` (token counts), `finish_reason` (how the reply ended)# and `max_output_tokens` (the ceiling sent) — copying only messages that carry# one. Whole `notice` messages (error/interrupted/model-switch markers) are@@ -3149,6 +3163,7 @@ class TurnEngine:"_display","_outside","ts",+ "mid","reasoning","usage","finish_reason",diff --git a/coworker/observability/__init__.py b/coworker/observability/__init__.pynew file mode 100644index 00000000..97ab8c18--- /dev/null+++ b/coworker/observability/__init__.py@@ -0,0 +1,15 @@+"""Agent observability: recording every step of every turn (Phase 1).++The design is `ocw-context/docs/observability/phase-1/technical-design.md`; the contract+shared with the Rust harness SDK is `recording-format.md` 1.0 and its golden test.++- `recorder.Recorder`: the one sink for recording events, folding them into turns and steps.+- `store.RecordingStore`: `recordings.db`, next to `coworker.db`.+- `ids.new_ulid`: ids for messages (`mid`), turns and steps.+"""++from .ids import new_ulid+from .recorder import Recorder+from .store import RecordingStore++__all__ = ["Recorder", "RecordingStore", "new_ulid"]diff --git a/coworker/observability/ids.py b/coworker/observability/ids.pynew file mode 100644index 00000000..1b9f2bac--- /dev/null+++ b/coworker/observability/ids.py@@ -0,0 +1,46 @@+"""ULIDs for recordings: message ids (`mid`), turn ids and step ids.++A ULID is 26 characters of Crockford base32: 48 bits of wall-clock milliseconds, then+80 random bits. Ids made later sort after ids made earlier. Within one millisecond the+random part is incremented instead of redrawn, so ids from one process stay strictly+increasing even when many are made at once (technical design §3.4).+"""++from __future__ import annotations++import os+import threading+import time++_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"+_RANDOM_MAX = (1 << 80) - 1++_lock = threading.Lock()+_last_ms = -1+_last_random = 0+++def _encode(value: int, length: int) -> str:+ out = []+ for _ in range(length):+ out.append(_ALPHABET[value & 31])+ value >>= 5+ return "".join(reversed(out))+++def new_ulid() -> str:+ """A new ULID, strictly greater than every earlier one from this process."""+ global _last_ms, _last_random+ with _lock:+ ms = time.time_ns() // 1_000_000+ if ms <= _last_ms:+ ms = _last_ms+ if _last_random == _RANDOM_MAX:+ ms += 1 # the random part ran out within one millisecond: borrow the next+ rand = int.from_bytes(os.urandom(10), "big")+ else:+ rand = _last_random + 1+ else:+ rand = int.from_bytes(os.urandom(10), "big")+ _last_ms, _last_random = ms, rand+ return _encode(ms, 10) + _encode(rand, 16)diff --git a/coworker/observability/recorder.py b/coworker/observability/recorder.pynew file mode 100644index 00000000..86c86a56--- /dev/null+++ b/coworker/observability/recorder.py@@ -0,0 +1,393 @@+"""The recorder: the one sink for recording events (observability technical design §3.2).++Hook points in the engine and the tagged provider views never write records directly. They+send recording events — `turn_started`, `turn_ended`, `step_started`, `step_updated`,+`step_ended` — to `Recorder.emit()`. The recorder folds them into turn and step records by+the rules of recording-format.md 1.0 (section 2.3), keeps the canonical step order (section+4), and hands every changed record to its store.++Every event carries `v`, `at_ms` (wall clock) and `mono_ms` (monotonic clock). Durations come+from `mono_ms` only, and a step's `started_at` is anchored to its turn's start (§7.3), so a+wall-clock jump mid-turn cannot reorder steps. `ended_at` is never stored: it is always+`started_at + duration_ms`.++Thread-safe (one lock): events arrive from the event loop, tool threads, the stream thread+and the shadow-review task at once. The golden test (`tests/observability/`) checks this+module against the shared scenarios: the same events must fold to the same recording in the+Rust engine too.+"""++from __future__ import annotations++import copy+import logging+import threading+import time+from dataclasses import dataclass, field+from typing import TYPE_CHECKING, Any, Callable, Optional++from .ids import new_ulid++if TYPE_CHECKING:+ from .store import RecordingStore++log = logging.getLogger(__name__)++EVENT_V = 1 # the event contract version (§3.2)+SCHEMA_VERSION = 1 # turn.schema_version: the record layout of format 1.x (§4, §11)++# The canonical order (recording-format.md section 4): the kind order used after start time+# and the zero-length-first rule.+KIND_ORDER = {+ "context": 0,+ "summary": 1,+ "model": 2,+ "auto_approver": 3,+ "wait": 4,+ "tool": 5,+ "notice": 6,+}++TURN_FIELDS = (+ "turn_id", "session_id", "seq", "kind", "trigger", "started_at", "duration_ms", "status",+ "incomplete", "approval_mode", "attended", "reviewer", "stamp", "first_message_id",+ "last_message_id", "schema_version",+)+STEP_FIELDS = (+ "step_id", "turn_id", "session_id", "parent_step_id", "seq", "kind", "name", "started_at",+ "duration_ms", "status", "call_id", "call_index", "message_id", "shadow", "after_turn",+ "attrs", "content",+)++# An ended turn stays in memory this long, for the events that arrive after it ended (an+# after-turn title call, a step's own late end, §7.4). Its records are already in the store.+KEEP_ENDED_TURN_MS = 15 * 60 * 1000+++@dataclass+class Turn:+ turn_id: str+ session_id: str+ seq: int+ kind: str # run | resume | retry+ trigger: str # user | channel | schedule | team_wake | unknown+ started_at: int+ approval_mode: Optional[str]+ attended: Optional[bool]+ reviewer: Optional[dict[str, Any]]+ stamp: dict[str, Any]+ first_message_id: Optional[str] = None+ last_message_id: Optional[str] = None+ duration_ms: Optional[int] = None+ status: str = "running"+ incomplete: bool = False+ schema_version: int = SCHEMA_VERSION+ mono_start: Optional[int] = field(default=None, repr=False) # not part of the record+ mono_end: Optional[int] = field(default=None, repr=False)++ @property+ def ended_at(self) -> Optional[int]:+ return None if self.duration_ms is None else self.started_at + self.duration_ms++ def record(self) -> dict[str, Any]:+ return {k: copy.deepcopy(getattr(self, k)) for k in TURN_FIELDS}+++@dataclass+class Step:+ step_id: str+ turn_id: Optional[str]+ session_id: Optional[str]+ kind: str+ name: str+ started_at: int+ parent_step_id: Optional[str] = None+ call_id: Optional[str] = None+ call_index: Optional[int] = None # the call's position in the model's tool-call list+ message_id: Optional[str] = None+ duration_ms: Optional[int] = None+ status: str = "running"+ shadow: bool = False+ after_turn: bool = False+ attrs: dict[str, Any] = field(default_factory=dict)+ content: dict[str, Any] = field(default_factory=dict) # content and personal data only+ seq: Optional[int] = None # assigned when the turn ends+ mono_start: Optional[int] = field(default=None, repr=False) # not part of the record+ closed_by_turn: bool = field(default=False, repr=False)++ @property+ def ended_at(self) -> Optional[int]:+ return None if self.duration_ms is None else self.started_at + self.duration_ms++ def record(self) -> dict[str, Any]:+ return {k: copy.deepcopy(getattr(self, k)) for k in STEP_FIELDS}+++def _merge_top(into: dict[str, Any], new: Optional[dict[str, Any]]) -> None:+ """step_updated / step_ended merge: each top-level key replaces the same key."""+ for k, v in (new or {}).items():+ into[k] = copy.deepcopy(v)+++def now_ms() -> tuple[int, int]:+ """(at_ms, mono_ms) for an event sent now."""+ return time.time_ns() // 1_000_000, time.monotonic_ns() // 1_000_000+++def new_turn_id() -> str:+ return new_ulid()+++def new_step_id() -> str:+ return new_ulid()+++class Recorder:+ """The sink. `emit()` is the only way in.++ With a `store`, every record an event changes is handed to it to be written (the store+ writes on its own thread, so `emit()` never waits on the disk). `listeners` get each+ event after it is folded: that is how the live view receives the same events (§12).+ """++ def __init__(self, store: Optional["RecordingStore"] = None):+ self.store = store+ self.turns: dict[str, Turn] = {}+ self.steps: dict[str, Step] = {}+ self._lock = threading.RLock()+ self._turn_count: dict[str, int] = {} # session_id -> turns seen, for `seq`+ self._listeners: list[Callable[[dict[str, Any]], None]] = []++ # -- listeners ---------------------------------------------------------------------------+ def add_listener(self, fn: Callable[[dict[str, Any]], None]) -> Callable[[], None]:+ """Call `fn(event)` after each event is folded. Returns a function that removes it."""+ with self._lock:+ self._listeners.append(fn)++ def remove() -> None:+ with self._lock:+ if fn in self._listeners:+ self._listeners.remove(fn)++ return remove++ # -- the event sink (recording-format.md section 2.3) ----------------------------------+ def emit(self, ev: dict[str, Any]) -> None:+ """Fold one recording event. Never raises: recording must not break a turn."""+ try:+ with self._lock:+ self._fold(ev)+ listeners = list(self._listeners)+ except Exception:+ log.exception("recorder: could not fold %s", ev.get("type"))+ return+ for fn in listeners:+ try:+ fn(ev)+ except Exception:+ log.exception("recorder: listener failed")++ def _fold(self, ev: dict[str, Any]) -> None:+ t = ev["type"]+ if t == "turn_started":+ self._turn_started(ev)+ elif t == "turn_ended":+ self._turn_ended(ev)+ elif t == "step_started":+ self._step_started(ev)+ elif t == "step_updated":+ s = self.steps.get(ev["step_id"])+ if s is not None: # no identity on an update: an unknown step cannot be made+ _merge_top(s.attrs, ev.get("attrs"))+ _merge_top(s.content, ev.get("content"))+ self._write_step(s)+ elif t == "step_ended":+ self._step_ended(ev)++ def _turn_started(self, ev: dict[str, Any]) -> None:+ if ev["turn_id"] in self.turns:+ return+ a = ev.get("attrs") or {}+ session_id = ev["session_id"]+ self._turn_count[session_id] = self._turn_count.get(session_id, 0) + 1+ seq = self._turn_count[session_id]+ if self.store is not None and seq == 1:+ # After a restart the session's earlier turns are only in the store.+ seq += self.store.turn_count(session_id)+ self._turn_count[session_id] = seq+ turn = Turn(+ turn_id=ev["turn_id"], session_id=session_id, seq=seq, kind=ev["kind"],+ trigger=ev["trigger"], started_at=ev["at_ms"], approval_mode=a.get("approval_mode"),+ attended=a.get("attended"), reviewer=copy.deepcopy(a.get("reviewer")),+ stamp=copy.deepcopy(ev.get("stamp") or {}),+ first_message_id=ev.get("first_message_id"), mono_start=ev["mono_ms"],+ )+ self.turns[turn.turn_id] = turn+ self._write_turn(turn)++ def _turn_ended(self, ev: dict[str, Any]) -> None:+ turn = self.turns.get(ev["turn_id"])+ if turn is None or turn.mono_end is not None:+ return+ turn.status, turn.last_message_id = ev["status"], ev.get("last_message_id")+ turn.mono_end = ev["mono_ms"]+ turn.duration_ms = max(0, ev["mono_ms"] - turn.mono_start)+ # §7.4: anything of this turn still open is closed at the turn's end.+ for s in self.steps.values():+ if (s.turn_id == turn.turn_id and s.duration_ms is None and s.status == "running"+ and not s.after_turn):+ s.duration_ms = max(0, turn.ended_at - s.started_at)+ s.status, s.closed_by_turn = "interrupted", True+ self._assign_seq()+ self._write_turn(turn)+ for s in self.steps.values():+ if s.turn_id == turn.turn_id:+ self._write_step(s)+ self._forget_old_turns(ev["mono_ms"])++ def _anchor(self, turn_id: Optional[str], at_ms: int, mono_ms: int) -> int:+ """§7.3: a step's start is its turn's start plus the monotonic time since then."""+ t = self.turns.get(turn_id) if turn_id else None+ if t is None or t.mono_start is None:+ return at_ms+ return t.started_at + (mono_ms - t.mono_start)++ def _step_started(self, ev: dict[str, Any]) -> None:+ if ev["step_id"] in self.steps:+ return+ s = Step(+ step_id=ev["step_id"], turn_id=ev.get("turn_id"), session_id=ev.get("session_id"),+ kind=ev["kind"], name=ev["name"],+ started_at=self._anchor(ev.get("turn_id"), ev["at_ms"], ev["mono_ms"]),+ parent_step_id=ev.get("parent_step_id"), call_id=ev.get("call_id"),+ call_index=ev.get("call_index"), shadow=bool(ev.get("shadow", False)),+ after_turn=bool(ev.get("after_turn", False)),+ attrs=copy.deepcopy(ev.get("attrs") or {}),+ content=copy.deepcopy(ev.get("content") or {}), mono_start=ev["mono_ms"],+ )+ self.steps[s.step_id] = s+ self._write_step(s)++ def _step_ended(self, ev: dict[str, Any]) -> None:+ s = self.steps.get(ev["step_id"])+ if s is None:+ # A step_ended with no matching start: the whole step from its identity copy.+ s = Step(+ step_id=ev["step_id"], turn_id=ev.get("turn_id"), session_id=ev.get("session_id"),+ kind=ev["kind"], name=ev["name"], started_at=ev["started_at"],+ parent_step_id=ev.get("parent_step_id"), call_id=ev.get("call_id"),+ call_index=ev.get("call_index"), shadow=bool(ev.get("shadow", False)),+ after_turn=bool(ev.get("after_turn", False)),+ )+ self.steps[s.step_id] = s+ s.duration_ms = max(0, ev["at_ms"] - s.started_at)+ elif s.closed_by_turn:+ # §7.4: the turn's end already closed it; only note how late its own end came.+ turn = self.turns.get(s.turn_id)+ if turn is not None and turn.mono_end is not None:+ s.attrs["ended_after_turn_ms"] = max(0, ev["mono_ms"] - turn.mono_end)+ self._write_step(s)+ return+ else:+ s.duration_ms = max(0, ev["mono_ms"] - s.mono_start)+ s.status = ev.get("status", "ok")+ if "message_id" in ev:+ s.message_id = ev["message_id"]+ _merge_top(s.attrs, ev.get("attrs"))+ _merge_top(s.content, ev.get("content"))+ if ev.get("error"):+ s.attrs["error"] = copy.deepcopy(ev["error"])+ turn = self.turns.get(s.turn_id) if s.turn_id else None+ if turn is not None and turn.mono_end is not None:+ # A step of a turn that already ended (an after-turn call): place it in order now.+ self._assign_seq()+ for x in self.steps.values():+ if x.turn_id == turn.turn_id:+ self._write_step(x)+ else:+ self._write_step(s)+ if turn is None and self.store is not None:+ # No turn in memory (a proxy call, or a turn from before a restart): nothing+ # later changes this step, and no turn's end will release it, so let it go.+ del self.steps[s.step_id]++ # -- the canonical order (recording-format.md section 4) ---------------------------------+ def _key(self, s: Step):+ p = self.steps.get(s.parent_step_id) if s.parent_step_id else None+ return (+ s.started_at,+ 0 if s.duration_ms == 0 else 1, # a zero-length step first+ KIND_ORDER.get(s.kind, 9),+ s.call_index or 0,+ s.name,+ # Ties the key above leaves (two helpers starting at once, a live and a shadow+ # check of one call): the parent's call position, then call id, then shadow.+ ((p.call_index or 0), p.call_id or "") if p else (-1, ""),+ s.call_id or "",+ s.shadow,+ )++ def _assign_seq(self) -> list[Step]:+ """Turns by (started_at, turn_id), each turn's steps in canonical order; then steps+ with no known turn (proxy calls) by the same key. `seq` restarts at 1 in every turn."""+ by_turn: dict[Optional[str], list[Step]] = {}+ for s in self.steps.values():+ by_turn.setdefault(s.turn_id if s.turn_id in self.turns else None, []).append(s)+ out: list[Step] = []+ for t in sorted(self.turns.values(), key=lambda t: (t.started_at, t.turn_id)):+ out += sorted(by_turn.get(t.turn_id, []), key=self._key)+ out_none = sorted(by_turn.get(None, []), key=self._key)+ seqs: dict[Optional[str], int] = {}+ for s in out + out_none:+ k = s.turn_id if s.turn_id in self.turns else None+ seqs[k] = seqs.get(k, 0) + 1+ s.seq = seqs[k]+ return out + out_none++ # -- writing ------------------------------------------------------------------------------+ def _write_turn(self, turn: Turn) -> None:+ if self.store is not None:+ self.store.write_turn(turn.record())++ def _write_step(self, s: Step) -> None:+ if self.store is not None:+ self.store.write_step(s.record())++ def _forget_old_turns(self, mono_now: int) -> None:+ """Drop turns that ended long ago, and their steps, from memory (they are stored)."""+ if self.store is None:+ return # nothing else holds them+ old = {+ t.turn_id for t in self.turns.values()+ if t.mono_end is not None and mono_now - t.mono_end > KEEP_ENDED_TURN_MS+ }+ if not old:+ return+ for tid in old:+ del self.turns[tid]+ for sid in [sid for sid, s in self.steps.items() if s.turn_id in old]:+ del self.steps[sid]++ def delete_session(self, session_id: str) -> None:+ """Forget a deleted session's turns and steps, in memory and in the store."""+ with self._lock:+ for tid in [tid for tid, t in self.turns.items() if t.session_id == session_id]:+ del self.turns[tid]+ for sid in [sid for sid, s in self.steps.items() if s.session_id == session_id]:+ del self.steps[sid]+ self._turn_count.pop(session_id, None)+ if self.store is not None:+ self.store.delete_session(session_id)++ # -- reading ------------------------------------------------------------------------------+ def ordered_steps(self) -> list[Step]:+ """Every step in memory in recording order (turn by turn, each in canonical order)."""+ with self._lock:+ return self._assign_seq()++ def as_dict(self) -> dict[str, Any]:+ """The recording in memory (format 1.0): {"turns": [...], "steps": [...]}."""+ with self._lock:+ steps = self._assign_seq()+ turns = sorted(self.turns.values(), key=lambda t: (t.started_at, t.turn_id))+ return {"turns": [t.record() for t in turns], "steps": [s.record() for s in steps]}diff --git a/coworker/observability/store.py b/coworker/observability/store.pynew file mode 100644index 00000000..fd017a2a--- /dev/null+++ b/coworker/observability/store.py@@ -0,0 +1,412 @@+"""`recordings.db`: where the recorder's turns and steps are saved (technical design §11).++A SQLite file next to `coworker.db`, on the machine that ran the work. It is separate from+`coworker.db` on purpose: recordings are pruned after 30 days while sessions are kept, the+layout can change without migrating the sessions database, and deleting this one file resets+all recordings and nothing else.++These tables are the Python layout only. The contract between engines is the recording JSON+of recording-format.md; `load_recording()` gives it back.++Writing never makes a turn wait. `write_turn` and `write_step` only put the record in a+pending map keyed by its id, so a step written three times before the writer runs is written+once, with its latest state; one background thread writes the map in a single transaction+every `FLUSH_MS`. Nothing is dropped, and no queue can grow past the number of records that+changed since the last write.+"""++from __future__ import annotations++import json+import logging+import sqlite3+import threading+import time+import zlib+from hashlib import sha256+from pathlib import Path+from typing import Any, Iterator, Optional++log = logging.getLogger(__name__)++FILENAME = "recordings.db"+RETENTION_DAYS = 30 # feature spec Q12+FLUSH_MS = 50+SWEEP_EVERY_S = 24 * 60 * 60+SWEEP_BATCH = 2000 # rows per transaction, so the file is never locked for long (P-8)+SWEEP_PAUSE_S = 0.05++_SCHEMA = """+CREATE TABLE IF NOT EXISTS turns (+ turn_id TEXT PRIMARY KEY, session_id TEXT NOT NULL, seq INTEGER, kind TEXT, trigger TEXT,+ started_at INTEGER, duration_ms INTEGER, status TEXT, incomplete INTEGER DEFAULT 0,+ approval_mode TEXT, attended INTEGER, reviewer TEXT, stamp TEXT,+ first_message_id TEXT, last_message_id TEXT,+ schema_version INTEGER NOT NULL DEFAULT 1);+CREATE INDEX IF NOT EXISTS turns_session ON turns(session_id, seq);+CREATE INDEX IF NOT EXISTS turns_started ON turns(started_at);+CREATE TABLE IF NOT EXISTS steps (+ step_id TEXT PRIMARY KEY, turn_id TEXT, session_id TEXT, parent_step_id TEXT,+ seq INTEGER, kind TEXT, name TEXT, started_at INTEGER, duration_ms INTEGER, status TEXT,+ call_id TEXT, call_index INTEGER, message_id TEXT,+ shadow INTEGER DEFAULT 0, after_turn INTEGER DEFAULT 0,+ purpose TEXT, model TEXT, usage_reported INTEGER,+ input_fresh INTEGER, cache_read INTEGER, cache_write INTEGER, output INTEGER, reasoning INTEGER,+ error_type TEXT, served_model TEXT, provider_request_id TEXT, context_window INTEGER,+ attrs TEXT, content TEXT, provider_meta BLOB);+CREATE INDEX IF NOT EXISTS steps_turn ON steps(turn_id, seq);+CREATE INDEX IF NOT EXISTS steps_call ON steps(session_id, call_id);+CREATE INDEX IF NOT EXISTS steps_usage ON steps(session_id, kind, purpose, model);+CREATE INDEX IF NOT EXISTS steps_started ON steps(started_at);+CREATE TABLE IF NOT EXISTS exchange_pieces (+ sha256 TEXT PRIMARY KEY, data BLOB NOT NULL, size INTEGER NOT NULL, first_seen INTEGER NOT NULL);+CREATE TABLE IF NOT EXISTS step_pieces (+ step_id TEXT NOT NULL, sha256 TEXT NOT NULL, PRIMARY KEY (step_id, sha256));+CREATE INDEX IF NOT EXISTS step_pieces_sha ON step_pieces(sha256);+"""++_TURN_COLUMNS = (+ "turn_id", "session_id", "seq", "kind", "trigger", "started_at", "duration_ms", "status",+ "incomplete", "approval_mode", "attended", "reviewer", "stamp", "first_message_id",+ "last_message_id", "schema_version",+)+_STEP_COLUMNS = (+ "step_id", "turn_id", "session_id", "parent_step_id", "seq", "kind", "name", "started_at",+ "duration_ms", "status", "call_id", "call_index", "message_id", "shadow", "after_turn",+ "purpose", "model", "usage_reported", "input_fresh", "cache_read", "cache_write", "output",+ "reasoning", "error_type", "served_model", "provider_request_id", "context_window", "attrs",+ "content", "provider_meta",+)+_USAGE_PARTS = ("input_fresh", "cache_read", "cache_write", "output", "reasoning")+++def _upsert(table: str, columns: tuple[str, ...], key: str, sticky: tuple[str, ...] = ()) -> str:+ sets = ", ".join(+ f"{c} = MAX({table}.{c}, excluded.{c})" if c in sticky else f"{c} = excluded.{c}"+ for c in columns if c != key+ )+ return (+ f"INSERT INTO {table} ({', '.join(columns)}) VALUES ({', '.join('?' * len(columns))}) "+ f"ON CONFLICT({key}) DO UPDATE SET {sets}"+ )+++# `incomplete` only ever goes from 0 to 1.+_UPSERT_TURN = _upsert("turns", _TURN_COLUMNS, "turn_id", sticky=("incomplete",))+_UPSERT_STEP = _upsert("steps", _STEP_COLUMNS, "step_id")+++def _js(value: Any) -> Optional[str]:+ return None if value is None else json.dumps(value, ensure_ascii=False, sort_keys=True)+++def _bool(value: Any) -> Optional[int]:+ return None if value is None else int(bool(value))+++def _turn_row(t: dict[str, Any]) -> tuple:+ return (+ t["turn_id"], t["session_id"], t.get("seq"), t.get("kind"), t.get("trigger"),+ t.get("started_at"), t.get("duration_ms"), t.get("status"), int(bool(t.get("incomplete"))),+ t.get("approval_mode"), _bool(t.get("attended")), _js(t.get("reviewer")),+ _js(t.get("stamp") or {}), t.get("first_message_id"), t.get("last_message_id"),+ t.get("schema_version", 1),+ )+++def _piece_refs(value: Any) -> Iterator[str]:+ """Every piece an exchange points at: manifest `$blob`s, a whole-body `blob`, `body_blob`."""+ if isinstance(value, dict):+ for k, v in value.items():+ if k in ("$blob", "blob", "body_blob") and isinstance(v, str):+ yield v+ else:+ yield from _piece_refs(v)+ elif isinstance(value, list):+ for v in value:+ yield from _piece_refs(v)+++def _step_row(s: dict[str, Any]) -> tuple:+ attrs = dict(s.get("attrs") or {})+ # provider_meta has its own compressed column, so the light step list and the usage sums+ # never read it (§5.2.1, §11).+ meta = attrs.pop("provider_meta", None)+ usage = attrs.get("usage") if isinstance(attrs.get("usage"), dict) else None+ if s.get("kind") == "model":+ reported: Optional[int] = int(usage is not None)+ else:+ reported = _bool(attrs.get("usage_reported"))+ facts = attrs.get("provider_facts") or {}+ error = attrs.get("error") if isinstance(attrs.get("error"), dict) else {}+ return (+ s["step_id"], s.get("turn_id"), s.get("session_id"), s.get("parent_step_id"), s.get("seq"),+ s.get("kind"), s.get("name"), s.get("started_at"), s.get("duration_ms"), s.get("status"),+ s.get("call_id"), s.get("call_index"), s.get("message_id"), int(bool(s.get("shadow"))),+ int(bool(s.get("after_turn"))), attrs.get("purpose"), attrs.get("model"), reported,+ *((usage or {}).get(p) for p in _USAGE_PARTS),+ error.get("type"), facts.get("served_model"), facts.get("provider_request_id"),+ attrs.get("context_window"), _js(attrs), _js(s.get("content") or {}),+ None if meta is None else zlib.compress(_js(meta).encode("utf-8")),+ )+++class RecordingStore:+ """`recordings.db`. One connection, guarded by a lock; one writer thread."""++ def __init__(+ self,+ path: str | Path,+ *,+ retention_days: Optional[int] = RETENTION_DAYS,+ background: bool = True,+ ) -> None:+ self.path = Path(path).expanduser()+ self.path.parent.mkdir(parents=True, exist_ok=True)+ self.retention_days = retention_days+ self._lock = threading.RLock()+ self._conn = sqlite3.connect(self.path, check_same_thread=False)+ self._conn.row_factory = sqlite3.Row+ self._conn.execute("PRAGMA journal_mode=WAL")+ self._conn.executescript(_SCHEMA)+ self._conn.commit()+ # Records waiting to be written, by id; the latest state of each replaces the last.+ self._pending_turns: dict[str, dict[str, Any]] = {}+ self._pending_steps: dict[str, dict[str, Any]] = {}+ self._pending_lock = threading.Lock()+ self._wake = threading.Event()+ self._closed = threading.Event()+ self._last_sweep = 0.0+ self._thread: Optional[threading.Thread] = None+ if background:+ self._thread = threading.Thread(+ target=self._run, name="recordings-writer", daemon=True+ )+ self._thread.start()++ @classmethod+ def beside(cls, coworker_db_dir: str | Path, **kw: Any) -> "RecordingStore":+ """The store for a data folder: `recordings.db` next to its `coworker.db`."""+ return cls(Path(coworker_db_dir) / FILENAME, **kw)++ # -- writing (called by the recorder; never blocks on the disk) --------------------------+ def write_turn(self, record: dict[str, Any]) -> None:+ with self._pending_lock:+ self._pending_turns[record["turn_id"]] = record+ self._wake.set()++ def write_step(self, record: dict[str, Any]) -> None:+ with self._pending_lock:+ self._pending_steps[record["step_id"]] = record+ self._wake.set()++ def flush(self) -> None:+ """Write everything pending now, on the calling thread."""+ # The connection lock is taken before the pending map is swapped, so a session+ # deleted meanwhile cannot be written back by a flush that started before it.+ with self._lock:+ with self._pending_lock:+ turns, self._pending_turns = self._pending_turns, {}+ steps, self._pending_steps = self._pending_steps, {}+ if not turns and not steps:+ return+ try:+ with self._conn:+ self._conn.executemany(_UPSERT_TURN, [_turn_row(t) for t in turns.values()])+ self._conn.executemany(_UPSERT_STEP, [_step_row(s) for s in steps.values()])+ for s in steps.values():+ refs = set(_piece_refs((s.get("content") or {}).get("exchange")))+ if refs:+ self._conn.executemany(+ "INSERT OR IGNORE INTO step_pieces (step_id, sha256) VALUES (?, ?)",+ [(s["step_id"], r) for r in refs],+ )+ except Exception:+ log.exception("recordings: write failed (%d turns, %d steps)", len(turns), len(steps))++ def _run(self) -> None:+ while not self._closed.is_set():+ # Asleep until there is something to write (or a day passes, for the sweep).+ self._wake.wait(timeout=SWEEP_EVERY_S)+ self._wake.clear()+ self.flush()+ if (+ self.retention_days is not None+ and time.time() - self._last_sweep >= SWEEP_EVERY_S+ ):+ self._last_sweep = time.time()+ try:+ self.sweep()+ except Exception:+ log.exception("recordings: retention sweep failed")+ self._closed.wait(FLUSH_MS / 1000)+ self.flush()++ def close(self) -> None:+ self._closed.set()+ self._wake.set()+ if self._thread is not None:+ self._thread.join(timeout=5)+ else:+ self.flush()+ with self._lock:+ self._conn.close()++ # -- exchange pieces (TD-17) --------------------------------------------------------------+ def put_piece(self, data: bytes) -> str:+ """Store one exchange piece once, compressed, keyed by its SHA-256. Returns the key."""+ key = sha256(data).hexdigest()+ with self._lock, self._conn:+ self._conn.execute(+ "INSERT OR IGNORE INTO exchange_pieces (sha256, data, size, first_seen) "+ "VALUES (?, ?, ?, ?)",+ (key, zlib.compress(data), len(data), int(time.time() * 1000)),+ )+ return key++ def get_piece(self, key: str) -> Optional[bytes]:+ with self._lock:+ row = self._conn.execute(+ "SELECT data FROM exchange_pieces WHERE sha256 = ?", (key,)+ ).fetchone()+ return None if row is None else zlib.decompress(row["data"])++ # -- deleting -----------------------------------------------------------------------------+ def delete_session(self, session_id: str) -> None:+ """The session-delete cascade (§11): its turns, steps and the pieces only they used."""+ with self._lock, self._conn:+ with self._pending_lock:+ self._pending_turns = {+ k: v for k, v in self._pending_turns.items()+ if v.get("session_id") != session_id+ }+ self._pending_steps = {+ k: v for k, v in self._pending_steps.items()+ if v.get("session_id") != session_id+ }+ self._conn.execute(+ "DELETE FROM step_pieces WHERE step_id IN "+ "(SELECT step_id FROM steps WHERE session_id = ?)",+ (session_id,),+ )+ self._conn.execute("DELETE FROM steps WHERE session_id = ?", (session_id,))+ self._conn.execute("DELETE FROM turns WHERE session_id = ?", (session_id,))+ self._delete_unused_pieces()++ def sweep(self, *, now_ms: Optional[int] = None) -> int:+ """Delete turns older than the retention period, their steps, then unused pieces.++ Runs in batches of `SWEEP_BATCH` rows with a short pause between them. Steps with no+ known turn (proxy calls) age out by their own start time. Returns the turns deleted.+ """+ if self.retention_days is None:+ return 0+ now = int(time.time() * 1000) if now_ms is None else now_ms+ cutoff = now - self.retention_days * 24 * 60 * 60 * 1000+ deleted = 0+ while True:+ with self._lock, self._conn:+ ids = [+ r["turn_id"]+ for r in self._conn.execute(+ "SELECT turn_id FROM turns WHERE started_at < ? LIMIT ?",+ (cutoff, SWEEP_BATCH),+ )+ ]+ if ids:+ marks = ", ".join("?" * len(ids))+ self._conn.execute(+ "DELETE FROM step_pieces WHERE step_id IN "+ f"(SELECT step_id FROM steps WHERE turn_id IN ({marks}))",+ ids,+ )+ self._conn.execute(f"DELETE FROM steps WHERE turn_id IN ({marks})", ids)+ self._conn.execute(f"DELETE FROM turns WHERE turn_id IN ({marks})", ids)+ deleted += len(ids)+ if len(ids) < SWEEP_BATCH:+ break+ time.sleep(SWEEP_PAUSE_S)+ while True:+ with self._lock, self._conn:+ ids = [+ r["step_id"]+ for r in self._conn.execute(+ "SELECT step_id FROM steps WHERE started_at < ? AND "+ "(turn_id IS NULL OR turn_id NOT IN (SELECT turn_id FROM turns)) LIMIT ?",+ (cutoff, SWEEP_BATCH),+ )+ ]+ if ids:+ marks = ", ".join("?" * len(ids))+ self._conn.execute(f"DELETE FROM step_pieces WHERE step_id IN ({marks})", ids)+ self._conn.execute(f"DELETE FROM steps WHERE step_id IN ({marks})", ids)+ if len(ids) < SWEEP_BATCH:+ break+ time.sleep(SWEEP_PAUSE_S)+ self._delete_unused_pieces()+ return deleted++ def _delete_unused_pieces(self) -> None:+ while True:+ with self._lock, self._conn:+ cur = self._conn.execute(+ "DELETE FROM exchange_pieces WHERE sha256 IN (SELECT sha256 FROM "+ "exchange_pieces WHERE sha256 NOT IN (SELECT sha256 FROM step_pieces) "+ "LIMIT ?)",+ (SWEEP_BATCH,),+ )+ if cur.rowcount < SWEEP_BATCH:+ break+ time.sleep(SWEEP_PAUSE_S)++ # -- reading ------------------------------------------------------------------------------+ def turn_count(self, session_id: str) -> int:+ with self._lock:+ row = self._conn.execute(+ "SELECT COUNT(*) AS n FROM turns WHERE session_id = ?", (session_id,)+ ).fetchone()+ return int(row["n"])++ def load_recording(self, session_id: str) -> dict[str, Any]:+ """A session's recording as format 1.0 JSON: {"turns": [...], "steps": [...]}.+ Turns by (started_at, turn_id); each turn's steps by `seq`."""+ self.flush()+ with self._lock:+ turns = self._conn.execute(+ "SELECT * FROM turns WHERE session_id = ? ORDER BY started_at, turn_id",+ (session_id,),+ ).fetchall()+ steps = self._conn.execute(+ "SELECT * FROM steps WHERE session_id = ?", (session_id,)+ ).fetchall()+ order = {t["turn_id"]: i for i, t in enumerate(turns)}+ steps = sorted(+ steps,+ key=lambda s: (order.get(s["turn_id"], len(order)), s["seq"] is None, s["seq"] or 0,+ s["started_at"] or 0),+ )+ return {"turns": [_turn_record(t) for t in turns], "steps": [_step_record(s) for s in steps]}+++def _turn_record(r: sqlite3.Row) -> dict[str, Any]:+ d = {k: r[k] for k in _TURN_COLUMNS}+ d["incomplete"] = bool(d["incomplete"])+ d["attended"] = None if d["attended"] is None else bool(d["attended"])+ d["reviewer"] = None if d["reviewer"] is None else json.loads(d["reviewer"])+ d["stamp"] = json.loads(d["stamp"] or "{}")+ return d+++def _step_record(r: sqlite3.Row) -> dict[str, Any]:+ attrs = json.loads(r["attrs"] or "{}")+ if r["provider_meta"] is not None:+ attrs["provider_meta"] = json.loads(zlib.decompress(r["provider_meta"]))+ return {+ "step_id": r["step_id"], "turn_id": r["turn_id"], "session_id": r["session_id"],+ "parent_step_id": r["parent_step_id"], "seq": r["seq"], "kind": r["kind"],+ "name": r["name"], "started_at": r["started_at"], "duration_ms": r["duration_ms"],+ "status": r["status"], "call_id": r["call_id"], "call_index": r["call_index"],+ "message_id": r["message_id"], "shadow": bool(r["shadow"]),+ "after_turn": bool(r["after_turn"]), "attrs": attrs,+ "content": json.loads(r["content"] or "{}"),+ }diff --git a/coworker/server/manager.py b/coworker/server/manager.pyindex 9aa5c4b3..907bfc26 100644--- a/coworker/server/manager.py+++ b/coworker/server/manager.py@@ -43,6 +43,7 @@ from ..teams.store import WORKER_WAITINGfrom ..unrouted import UnroutedStorefrom ..unattended import UnattendedRegistryfrom ..audit import AuditStore+from ..observability import Recorder, RecordingStorefrom ..config import load_config, workspace_allowed_commandsfrom ..conversations import ConversationStore, title_fromfrom ..engine import ApprovalOutcome, Approver, TurnEngine@@ -381,6 +382,10 @@ class SessionManager:# level, outside the memory table; read at engine build time.self.memory_settings = MemorySettingsStore(base / "memory-settings.json")self.audit_store = AuditStore(base / "coworker.db")+ # Observability (Phase 1, E7): recorded turns and steps, in their own file next to+ # coworker.db so they can be pruned and reset on their own.+ self.recordings_store = RecordingStore.beside(base)+ self.recorder = Recorder(store=self.recordings_store)self.session_store = ConversationStore(base)self.session_store.canonicalize_workspaces() # collapse /tmp vs /private/tmp etc.if self.default_workspace:@@ -6392,6 +6397,7 @@ class SessionManager:await self.stop_gateway()await self.mcp.aclose()self.audit_store.close()+ self.recordings_store.close()from ..providers import llamacpp_setupllamacpp_setup.runner().shutdown()@@ -8613,6 +8619,8 @@ class SessionManager:record = self.session_store.load(session_id)self._remove_spawn_worktree(session_id, record)ok = self.session_store.delete(session_id)+ # ...and its recorded turns and steps (observability §11, the session-delete cascade).+ self.recorder.delete_session(session_id)# Deleting a session is the one implicit unsubscribe (otherwise subscriptions are permanent).held = [sub.channel for sub in self.subscriptions.for_session(session_id)]self.subscriptions.remove_session(session_id)diff --git a/tests/corpora/observability/README.md b/tests/corpora/observability/README.mdnew file mode 100644index 00000000..975f098b--- /dev/null+++ b/tests/corpora/observability/README.md@@ -0,0 +1,13 @@+# Observability golden test++`golden-phase1/` is a copy of `docs/observability/golden/phase1/` in the `ocw-context`+repository: the shared test of recording format 1.0, frozen 2026-10-31. The Rust harness+SDK runs the same files, so both engines fold the same recording events into the same+recording.++Do not edit these files here. A change to the format needs a new version in `ocw-context`+(its `tracing-spec.md` §12), and then a fresh copy of the folder here.++`tests/test_observability_golden.py` replays every scenario's `events.jsonl` into the+recorder and compares the result with `expected-recording.json`. `expected-numbers.json`+(the screen numbers) is checked once the read endpoints are built.diff --git a/tests/corpora/observability/golden-phase1/M-01a/events.jsonl b/tests/corpora/observability/golden-phase1/M-01a/events.jsonlnew file mode 100644index 00000000..8095cd1e--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01a/events.jsonl@@ -0,0 +1,8 @@+{"at_ms": 0, "attrs": {"approval_mode": "bypass-approvals", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"decision": {"origin": "bypass", "path": [{"detail": "bypass", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 9000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 9000, "last_message_id": "m4", "mono_ms": 9000, "session_id": "sess_A", "status": "interrupted", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-01a/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-01a/expected-numbers.jsonnew file mode 100644index 00000000..5e047dfd--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01a/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 7000,+ "total": 9000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1100+ },+ "by_purpose": {+ "main": 1100+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1100,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-01a/expected-recording.json b/tests/corpora/observability/golden-phase1/M-01a/expected-recording.jsonnew file mode 100644index 00000000..c12520bf--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01a/expected-recording.json@@ -0,0 +1,136 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "bypass",+ "path": [+ {+ "detail": "bypass",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 7000,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "bypass-approvals",+ "attended": true,+ "duration_ms": 9000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "interrupted",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-01b/events.jsonl b/tests/corpora/observability/golden-phase1/M-01b/events.jsonlnew file mode 100644index 00000000..f3864a14--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01b/events.jsonl@@ -0,0 +1,5 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "finish_reason": null, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6, "ttft_ms": 800, "usage": {"reported": false}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"at_ms": 1200, "last_message_id": "m2", "mono_ms": 1200, "session_id": "sess_A", "status": "interrupted", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-01b/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-01b/expected-numbers.jsonnew file mode 100644index 00000000..acd276f3--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01b/expected-numbers.json@@ -0,0 +1,25 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 1200,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 1200,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": true,+ "auto_approver_checks_not_reported": 0,+ "by_model": {},+ "by_purpose": {},+ "cache_share": null,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 0,+ "unreported_calls": 1+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-01b/expected-recording.json b/tests/corpora/observability/golden-phase1/M-01b/expected-recording.jsonnew file mode 100644index 00000000..1f93ccb2--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-01b/expected-recording.json@@ -0,0 +1,98 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": 800,+ "usage": {+ "reported": false+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1200,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "interrupted",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 1200,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "interrupted",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-02/events.jsonl b/tests/corpora/observability/golden-phase1/M-02/events.jsonlnew file mode 100644index 00000000..6b67547f--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-02/events.jsonl@@ -0,0 +1,14 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 8000, "cache_write": null, "input_fresh": 2000, "output": 300, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2300, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 2300, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2300, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2300, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3800, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"reported": false}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 3800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2300, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3800, "attrs": {}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 3800, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m5", "mono_ms": 4100, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3800, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 4100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5600, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 10400, "cache_write": null, "input_fresh": 600, "output": 400, "reasoning": 120, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 5600, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4100, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 5600, "last_message_id": "m6", "mono_ms": 5600, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-02/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-02/expected-numbers.jsonnew file mode 100644index 00000000..fb5ad9c7--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-02/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 5000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 600,+ "total": 5600,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": true,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "openai:gpt-5.1": 21700+ },+ "by_purpose": {+ "main": 21700+ },+ "cache_share": 0.876,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 21700,+ "unreported_calls": 1+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-02/expected-recording.json b/tests/corpora/observability/golden-phase1/M-02/expected-recording.jsonnew file mode 100644index 00000000..cfb9168d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-02/expected-recording.json@@ -0,0 +1,240 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "tool_calls",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 8000,+ "cache_write": null,+ "input_fresh": 2000,+ "output": 300,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 300,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "tool_calls",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2300,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {},+ "duration_ms": 300,+ "kind": "tool",+ "message_id": "m5",+ "name": "read_file",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3800,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 10400,+ "cache_write": null,+ "input_fresh": 600,+ "output": 400,+ "reasoning": 120,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4100,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 5600,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m6",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-03/events.jsonl b/tests/corpora/observability/golden-phase1/M-03/events.jsonlnew file mode 100644index 00000000..d1fcc09c--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-03/events.jsonl@@ -0,0 +1,11 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m3", "kind": "resume", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 100, "attrs": {"attended": true, "for_call_id": "c1", "kind": "approval", "where": "session"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 100, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"outcome": "approved"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 3000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 100, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 3000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 3500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 3500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 2000, "cache_write": 0, "input_fresh": 900, "output": 60, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 4500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3500, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 4500, "last_message_id": "m4", "mono_ms": 4500, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 4500, "content": {"resolved_by": "devika"}, "mono_ms": 4500, "session_id": "sess_A", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-03/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-03/expected-numbers.jsonnew file mode 100644index 00000000..785b3bd5--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-03/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 1000,+ "other": 100,+ "other_shown": true,+ "summary": 0,+ "tools": 500,+ "total": 4500,+ "waiting": 2900+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 2960+ },+ "by_purpose": {+ "main": 2960+ },+ "cache_share": 0.69,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 2960,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-03/expected-recording.json b/tests/corpora/observability/golden-phase1/M-03/expected-recording.jsonnew file mode 100644index 00000000..7ce01e01--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-03/expected-recording.json@@ -0,0 +1,170 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c1",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 2900,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 100,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 2000,+ "cache_write": 0,+ "input_fresh": 900,+ "output": 60,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3500,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 4500,+ "first_message_id": "m3",+ "incomplete": false,+ "kind": "resume",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-04/events.jsonl b/tests/corpora/observability/golden-phase1/M-04/events.jsonlnew file mode 100644index 00000000..0a1f7bf7--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-04/events.jsonl@@ -0,0 +1,21 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 800, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1010, "attrs": {"attended": true, "for_call_id": "c1", "kind": "approval", "where": "session"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 1010, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"outcome": "approved"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 3000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1010, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 3000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"detail": "always_command", "outcome": "approved_session", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 3500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 3500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 900, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 4500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3500, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4500, "attrs": {}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 4500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"decision": {"origin": "session_grant", "path": [{"outcome": "allowed", "stage": "permission"}, {"outcome": "session_grant", "stage": "grant"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m5", "mono_ms": 5000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4500, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 950, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 6000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {}, "call_id": "c3", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 6000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 6200, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c3", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m7", "mono_ms": 6200, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 6000, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 6200, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 6200, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1000, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m8", "mono_ms": 7000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 6200, "status": "ok", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 7000, "last_message_id": "m8", "mono_ms": 7000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 7000, "content": {"resolved_by": "devika"}, "mono_ms": 7000, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-04/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-04/expected-numbers.jsonnew file mode 100644index 00000000..b137540f--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-04/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 3800,+ "other": 10,+ "other_shown": false,+ "summary": 0,+ "tools": 1200,+ "total": 7000,+ "waiting": 1990+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 3850+ },+ "by_purpose": {+ "main": 3850+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 3850,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-04/expected-recording.json b/tests/corpora/observability/golden-phase1/M-04/expected-recording.jsonnew file mode 100644index 00000000..e1474923--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-04/expected-recording.json@@ -0,0 +1,354 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 800,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c1",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 1990,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1010,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "detail": "always_command",+ "outcome": "approved_session",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 900,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3500,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "session_grant",+ "path": [+ {+ "outcome": "allowed",+ "stage": "permission"+ },+ {+ "outcome": "session_grant",+ "stage": "grant"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m5",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4500,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 950,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c3",+ "call_index": 0,+ "content": {},+ "duration_ms": 200,+ "kind": "tool",+ "message_id": "m7",+ "name": "grep",+ "parent_step_id": null,+ "seq": 8,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 6000,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 800,+ "kind": "model",+ "message_id": "m8",+ "name": "model",+ "parent_step_id": null,+ "seq": 9,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 6200,+ "status": "ok",+ "step_id": "s9",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 7000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m8",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-05/events.jsonl b/tests/corpora/observability/golden-phase1/M-05/events.jsonlnew file mode 100644index 00000000..791a6c02--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-05/events.jsonl@@ -0,0 +1,55 @@+{"at_ms": 0, "attrs": {"approval_mode": "auto-approve", "attended": true, "reviewer": {"active": true, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "d1", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "d1", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1000, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 20, "reasoning": null, "reported": true}}, "call_id": "d1", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 1500, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"breaker": {"denials_in_row": 1, "tripped": false}, "result": "deny", "usage_reported": true}, "call_id": "d1", "call_index": 0, "content": {"reason": "Deletes files"}, "kind": "auto_approver", "message_id": null, "mono_ms": 1500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {}, "call_id": "d1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "d1", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 1500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "denied", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "d2", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 3000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "d2", "call_index": null, "content": {}, "kind": "model", "mono_ms": 3000, "name": "model", "parent_step_id": "step_7", "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 20, "reasoning": null, "reported": true}}, "call_id": "d2", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 3500, "name": "model", "parent_step_id": "step_7", "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"breaker": {"denials_in_row": 2, "tripped": false}, "result": "deny", "usage_reported": true}, "call_id": "d2", "call_index": 0, "content": {"reason": "Deletes files"}, "kind": "auto_approver", "message_id": null, "mono_ms": 3500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {}, "call_id": "d2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 3500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "d2", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 3500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3500, "status": "denied", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 4000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4000, "status": "ok", "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "d3", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 5000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "d3", "call_index": null, "content": {}, "kind": "model", "mono_ms": 5000, "name": "model", "parent_step_id": "step_11", "session_id": "sess_A", "shadow": false, "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 20, "reasoning": null, "reported": true}}, "call_id": "d3", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 5500, "name": "model", "parent_step_id": "step_11", "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5500, "attrs": {"breaker": {"denials_in_row": 3, "tripped": false}, "result": "deny", "usage_reported": true}, "call_id": "d3", "call_index": 0, "content": {"reason": "Deletes files"}, "kind": "auto_approver", "message_id": null, "mono_ms": 5500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5500, "attrs": {}, "call_id": "d3", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 5500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_13", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5500, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "d3", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 5500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5500, "status": "denied", "step_id": "step_13", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 6000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_14", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m8", "mono_ms": 7000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 6000, "status": "ok", "step_id": "step_14", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "d4", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 7000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_15", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "d4", "call_index": null, "content": {}, "kind": "model", "mono_ms": 7000, "name": "model", "parent_step_id": "step_15", "session_id": "sess_A", "shadow": false, "step_id": "step_16", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 20, "reasoning": null, "reported": true}}, "call_id": "d4", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 7500, "name": "model", "parent_step_id": "step_15", "session_id": "sess_A", "shadow": false, "started_at": 7000, "status": "ok", "step_id": "step_16", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 7500, "attrs": {"breaker": {"denials_in_row": 4, "tripped": false}, "result": "deny", "usage_reported": true}, "call_id": "d4", "call_index": 0, "content": {"reason": "Deletes files"}, "kind": "auto_approver", "message_id": null, "mono_ms": 7500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7000, "status": "ok", "step_id": "step_15", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 7500, "attrs": {}, "call_id": "d4", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 7500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_17", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7500, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "d4", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 7500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7500, "status": "denied", "step_id": "step_17", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 8000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 8000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_18", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m10", "mono_ms": 9000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 8000, "status": "ok", "step_id": "step_18", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "d5", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 9000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_19", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "d5", "call_index": null, "content": {}, "kind": "model", "mono_ms": 9000, "name": "model", "parent_step_id": "step_19", "session_id": "sess_A", "shadow": false, "step_id": "step_20", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 20, "reasoning": null, "reported": true}}, "call_id": "d5", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 9500, "name": "model", "parent_step_id": "step_19", "session_id": "sess_A", "shadow": false, "started_at": 9000, "status": "ok", "step_id": "step_20", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {"breaker": {"denials_in_row": 5, "tripped": true}, "result": "deny", "usage_reported": true}, "call_id": "d5", "call_index": 0, "content": {"reason": "Deletes files"}, "kind": "auto_approver", "message_id": null, "mono_ms": 9500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 9000, "status": "ok", "step_id": "step_19", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "notice", "mono_ms": 9500, "name": "reviewer_paused", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_21", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "notice", "message_id": null, "mono_ms": 9500, "name": "reviewer_paused", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 9500, "status": "ok", "step_id": "step_21", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {}, "call_id": "d5", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 9500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_22", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9500, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "d5", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 9500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 9500, "status": "denied", "step_id": "step_22", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 10000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_23", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 11000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m13", "mono_ms": 11000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10000, "status": "ok", "step_id": "step_23", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 11010, "attrs": {"attended": true, "for_call_id": "c6", "kind": "approval", "where": "session"}, "call_id": "c6", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 11010, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_24", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 15000, "attrs": {"outcome": "approved"}, "call_id": "c6", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 15000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 11010, "status": "ok", "step_id": "step_24", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 15000, "attrs": {}, "call_id": "c6", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 15000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_25", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 15500, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "skipped_paused", "stage": "auto_approver"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c6", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m14", "mono_ms": 15500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 15000, "status": "ok", "step_id": "step_25", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 15500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 15500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_26", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 16500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 20, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m15", "mono_ms": 16500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 15500, "status": "ok", "step_id": "step_26", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 16500, "last_message_id": "m15", "mono_ms": 16500, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 16500, "content": {"resolved_by": "devika"}, "mono_ms": 16500, "session_id": "sess_A", "step_id": "step_24", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-05/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-05/expected-numbers.jsonnew file mode 100644index 00000000..141a604a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-05/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 2500,+ "model": 7000,+ "other": 2510,+ "other_shown": true,+ "summary": 0,+ "tools": 500,+ "total": 16500,+ "waiting": 3990+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 3640,+ "anthropic:claude-sonnet-5 (auto_approver)": 1600+ },+ "by_purpose": {+ "auto_approver": 1600,+ "main": 3640+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 5240,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-05/expected-recording.json b/tests/corpora/observability/golden-phase1/M-05/expected-recording.jsonnew file mode 100644index 00000000..55bad495--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-05/expected-recording.json@@ -0,0 +1,985 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "d1",+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 1,+ "tripped": false+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "d1",+ "call_index": 0,+ "content": {+ "reason": "Deletes files"+ },+ "duration_ms": 500,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "d1",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "denied",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "d2",+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s8",+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 2,+ "tripped": false+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "d2",+ "call_index": 0,+ "content": {+ "reason": "Deletes files"+ },+ "duration_ms": 500,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 8,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "d2",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 9,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3500,+ "status": "denied",+ "step_id": "s9",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 10,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4000,+ "status": "ok",+ "step_id": "s10",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "d3",+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s12",+ "seq": 11,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s11",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 3,+ "tripped": false+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "d3",+ "call_index": 0,+ "content": {+ "reason": "Deletes files"+ },+ "duration_ms": 500,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 12,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s12",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "d3",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 13,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5500,+ "status": "denied",+ "step_id": "s13",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m8",+ "name": "model",+ "parent_step_id": null,+ "seq": 14,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 6000,+ "status": "ok",+ "step_id": "s14",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "d4",+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s16",+ "seq": 15,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7000,+ "status": "ok",+ "step_id": "s15",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 4,+ "tripped": false+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "d4",+ "call_index": 0,+ "content": {+ "reason": "Deletes files"+ },+ "duration_ms": 500,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 16,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7000,+ "status": "ok",+ "step_id": "s16",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "d4",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 17,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7500,+ "status": "denied",+ "step_id": "s17",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m10",+ "name": "model",+ "parent_step_id": null,+ "seq": 18,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 8000,+ "status": "ok",+ "step_id": "s18",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "d5",+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s20",+ "seq": 19,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 9000,+ "status": "ok",+ "step_id": "s19",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 5,+ "tripped": true+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "d5",+ "call_index": 0,+ "content": {+ "reason": "Deletes files"+ },+ "duration_ms": 500,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 20,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 9000,+ "status": "ok",+ "step_id": "s20",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "d5",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 21,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 9500,+ "status": "denied",+ "step_id": "s21",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {},+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 0,+ "kind": "notice",+ "message_id": null,+ "name": "reviewer_paused",+ "parent_step_id": null,+ "seq": 22,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 9500,+ "status": "ok",+ "step_id": "s22",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m13",+ "name": "model",+ "parent_step_id": null,+ "seq": 23,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10000,+ "status": "ok",+ "step_id": "s23",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c6",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c6",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 3990,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 24,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 11010,+ "status": "ok",+ "step_id": "s24",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "skipped_paused",+ "stage": "auto_approver"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c6",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m14",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 25,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 15000,+ "status": "ok",+ "step_id": "s25",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 20,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m15",+ "name": "model",+ "parent_step_id": null,+ "seq": 26,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 15500,+ "status": "ok",+ "step_id": "s26",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "auto-approve",+ "attended": true,+ "duration_ms": 16500,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m15",+ "reviewer": {+ "active": true,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-06a/events.jsonl b/tests/corpora/observability/golden-phase1/M-06a/events.jsonlnew file mode 100644index 00000000..86204759--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06a/events.jsonl@@ -0,0 +1,13 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m13", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": null, "ttft_ms": null, "usage": {"reported": false}}, "call_id": null, "call_index": null, "content": {}, "error": {"text": "prompt is too long: 210000 tokens > 200000 maximum context length", "type": "context_length"}, "kind": "model", "message_id": null, "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "error", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "summary", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 3000, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 40000, "output": 1500, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 6000, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"model_step_id": "step_4", "reason": "overflow", "tokens_before": null}, "call_id": null, "call_index": null, "content": {}, "kind": "summary", "mono_ms": 3000, "name": "summary", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "summary", "message_id": null, "mono_ms": 6000, "name": "summary", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 6000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"at_ms": 9000, "attrs": {"tokens_after": 7000}, "mono_ms": 9000, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 7000, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m15", "mono_ms": 9000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 6000, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 9000, "last_message_id": "m15", "mono_ms": 9000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-06a/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-06a/expected-numbers.jsonnew file mode 100644index 00000000..791906b2--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06a/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 6000,+ "other": 0,+ "other_shown": false,+ "summary": 3000,+ "tools": 0,+ "total": 9000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 7200,+ "anthropic:claude-sonnet-5 (summary)": 41500+ },+ "by_purpose": {+ "main": 7200,+ "summary": 41500+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 1,+ "pill": 48700,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-06a/expected-recording.json b/tests/corpora/observability/golden-phase1/M-06a/expected-recording.jsonnew file mode 100644index 00000000..fc8bfd2b--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06a/expected-recording.json@@ -0,0 +1,202 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "error": {+ "text": "prompt is too long: 210000 tokens > 200000 maximum context length",+ "type": "context_length"+ },+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "error",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "model_step_id": "s4",+ "reason": "overflow",+ "tokens_after": 7000,+ "tokens_before": null+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "summary",+ "message_id": null,+ "name": "summary",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "summary",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 40000,+ "output": 1500,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s3",+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 7000,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": "m15",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 6000,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 9000,+ "first_message_id": "m13",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m15",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-06c/events.jsonl b/tests/corpora/observability/golden-phase1/M-06c/events.jsonlnew file mode 100644index 00000000..864ae344--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06c/events.jsonl@@ -0,0 +1,10 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 45000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 2000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 45200, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 3000, "last_message_id": "m4", "mono_ms": 3000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-06c/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-06c/expected-numbers.jsonnew file mode 100644index 00000000..12df05be--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06c/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 1000,+ "total": 3000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 90400+ },+ "by_purpose": {+ "main": 90400+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 90400,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-06c/expected-recording.json b/tests/corpora/observability/golden-phase1/M-06c/expected-recording.jsonnew file mode 100644index 00000000..90bb9c68--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-06c/expected-recording.json@@ -0,0 +1,174 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 45000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 1000,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 45200,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 3000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-07/events.jsonl b/tests/corpora/observability/golden-phase1/M-07/events.jsonlnew file mode 100644index 00000000..7b5776f1--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-07/events.jsonl@@ -0,0 +1,12 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 800, "output": 40, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "u1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "read_fiel", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": null, "risk_class": null, "sandbox": null}, "call_id": "u1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 1000, "name": "read_fiel", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "error", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "b1", "call_index": 1, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"decision": {"origin": null, "path": []}, "result_bytes": null, "risk_class": "read", "sandbox": null}, "call_id": "b1", "call_index": 1, "content": {}, "kind": "tool", "message_id": "m4", "mono_ms": 1000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "error", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 900, "output": 40, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m5", "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 3000, "last_message_id": "m5", "mono_ms": 3000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-07/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-07/expected-numbers.jsonnew file mode 100644index 00000000..4b098b23--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-07/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 1000,+ "other_shown": true,+ "summary": 0,+ "tools": 0,+ "total": 3000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1780+ },+ "by_purpose": {+ "main": 1780+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1780,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-07/expected-recording.json b/tests/corpora/observability/golden-phase1/M-07/expected-recording.jsonnew file mode 100644index 00000000..15bbab16--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-07/expected-recording.json@@ -0,0 +1,201 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 800,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": null,+ "sandbox": null+ },+ "call_id": "u1",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": "m3",+ "name": "read_fiel",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "error",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": null,+ "path": []+ },+ "result_bytes": null,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "b1",+ "call_index": 1,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": "m4",+ "name": "grep",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "error",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 900,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m5",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 3000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m5",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-08/events.jsonl b/tests/corpora/observability/golden-phase1/M-08/events.jsonlnew file mode 100644index 00000000..b77e444b--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-08/events.jsonl@@ -0,0 +1,18 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 10, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 500, "attrs": {}, "call_id": "g0", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 500, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 600, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "g0", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 600, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 500, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 10, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {}, "call_id": "g1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1500, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1600, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "g1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m5", "mono_ms": 1600, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 10, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 2500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2500, "attrs": {}, "call_id": "g2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2500, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2600, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "g2", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m7", "mono_ms": 2600, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2500, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "notice", "mono_ms": 3000, "name": "step_limit", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "notice", "message_id": null, "mono_ms": 3000, "name": "step_limit", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3000, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 3000, "last_message_id": "m7", "mono_ms": 3000, "session_id": "sess_A", "status": "max_iterations_exceeded", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-08/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-08/expected-numbers.jsonnew file mode 100644index 00000000..fc245baf--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-08/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 1500,+ "other": 1200,+ "other_shown": true,+ "summary": 0,+ "tools": 300,+ "total": 3000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 930+ },+ "by_purpose": {+ "main": 930+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 930,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-08/expected-recording.json b/tests/corpora/observability/golden-phase1/M-08/expected-recording.jsonnew file mode 100644index 00000000..92888c07--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-08/expected-recording.json@@ -0,0 +1,297 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 10,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "g0",+ "call_index": 0,+ "content": {},+ "duration_ms": 100,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 500,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 10,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "g1",+ "call_index": 0,+ "content": {},+ "duration_ms": 100,+ "kind": "tool",+ "message_id": "m5",+ "name": "grep",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 10,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "g2",+ "call_index": 0,+ "content": {},+ "duration_ms": 100,+ "kind": "tool",+ "message_id": "m7",+ "name": "grep",+ "parent_step_id": null,+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2500,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {},+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 0,+ "kind": "notice",+ "message_id": null,+ "name": "step_limit",+ "parent_step_id": null,+ "seq": 8,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3000,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 3000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m7",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "max_iterations_exceeded",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-09/events.jsonl b/tests/corpora/observability/golden-phase1/M-09/events.jsonlnew file mode 100644index 00000000..e5c5fb03--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-09/events.jsonl@@ -0,0 +1,16 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 5000, "last_message_id": "m2", "mono_ms": 5000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 1000, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 1000, "session_id": "sess_B", "stamp": {}, "trigger": "user", "turn_id": "sess_B:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 1000, "name": "context", "parent_step_id": null, "session_id": "sess_B", "shadow": false, "step_id": "step_3", "turn_id": "sess_B:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1005, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 1005, "name": "context", "parent_step_id": null, "session_id": "sess_B", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_3", "turn_id": "sess_B:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_B", "shadow": false, "step_id": "step_4", "turn_id": "sess_B:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 2000, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_B", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_4", "turn_id": "sess_B:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 3000, "last_message_id": "m2", "mono_ms": 3000, "session_id": "sess_B", "status": "completed", "turn_id": "sess_B:turn_1", "type": "turn_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": null, "model": "x", "provider": "x", "provider_title": "Anthropic", "purpose": "proxy", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": null, "shadow": false, "step_id": "step_5", "turn_id": null, "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 400, "output": 40, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 2500, "name": "model", "parent_step_id": null, "session_id": null, "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_5", "turn_id": null, "type": "step_ended", "v": 1}+{"after_turn": true, "at_ms": 5100, "attrs": {"context_window": null, "model": "x", "provider": "x", "provider_title": "Anthropic", "purpose": "title", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 5100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": true, "at_ms": 5400, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 12, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 5400, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5100, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-09/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-09/expected-numbers.jsonnew file mode 100644index 00000000..76f0ef10--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-09/expected-numbers.json@@ -0,0 +1,75 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 5000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 5000,+ "waiting": 0+ },+ "sess_B:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 2000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 3300,+ "x (title)": 312+ },+ "by_purpose": {+ "main": 3300,+ "title": 312+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 3612,+ "unreported_calls": 0+ },+ "usage_by_session": {+ "sess_A": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1100,+ "x (title)": 312+ },+ "by_purpose": {+ "main": 1100,+ "title": 312+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1412,+ "unreported_calls": 0+ },+ "sess_B": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 2200+ },+ "by_purpose": {+ "main": 2200+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 2200,+ "unreported_calls": 0+ }+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-09/expected-recording.json b/tests/corpora/observability/golden-phase1/M-09/expected-recording.jsonnew file mode 100644index 00000000..556262c5--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-09/expected-recording.json@@ -0,0 +1,276 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": true,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "x",+ "provider": "x",+ "provider_title": "Anthropic",+ "purpose": "title",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 12,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 300,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5100,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_B",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_B:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 2000,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_B",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_B:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "x",+ "provider": "x",+ "provider_title": "Anthropic",+ "purpose": "proxy",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 400,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 1,+ "session_id": null,+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s6",+ "turn_id": null+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 5000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ },+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 2000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_B",+ "stamp": {},+ "started_at": 1000,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_B:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-10/events.jsonl b/tests/corpora/observability/golden-phase1/M-10/events.jsonlnew file mode 100644index 00000000..515e8353--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-10/events.jsonl@@ -0,0 +1,14 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 10, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7010, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 22600, "cache_write": 2400, "input_fresh": 6200, "output": 610, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 7010, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 7020, "last_message_id": "m2", "mono_ms": 7020, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 7050, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m3", "kind": "run", "mono_ms": 7050, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_2", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 7050, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 7050, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_2", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7055, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 7055, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7050, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_2", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 7060, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 7060, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_2", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 9000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 9000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7060, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_2", "type": "step_ended", "v": 1}+{"at_ms": 9000, "last_message_id": "m4", "mono_ms": 9000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_2", "type": "turn_ended", "v": 1}+{"after_turn": true, "at_ms": 7100, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "title", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 7100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": true, "at_ms": 7600, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 12, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 7600, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7100, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-10/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-10/expected-numbers.jsonnew file mode 100644index 00000000..043027ba--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-10/expected-numbers.json@@ -0,0 +1,41 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 7000,+ "other": 20,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 7020,+ "waiting": 0+ },+ "sess_A:turn_2": {+ "auto_approver": 0,+ "model": 1940,+ "other": 10,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 1950,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 32360,+ "anthropic:claude-sonnet-5 (title)": 312+ },+ "by_purpose": {+ "main": 32360,+ "title": 312+ },+ "cache_share": 0.706,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 32672,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-10/expected-recording.json b/tests/corpora/observability/golden-phase1/M-10/expected-recording.jsonnew file mode 100644index 00000000..ac31d882--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-10/expected-recording.json@@ -0,0 +1,232 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 22600,+ "cache_write": 2400,+ "input_fresh": 6200,+ "output": 610,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 7000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": true,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "title",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 12,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7100,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7050,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_2"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1940,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7060,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_2"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 7020,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ },+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 1950,+ "first_message_id": "m3",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 2,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 7050,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_2"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-12/events.jsonl b/tests/corpora/observability/golden-phase1/M-12/events.jsonlnew file mode 100644index 00000000..9cc64f87--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-12/events.jsonl@@ -0,0 +1,10 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": false, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1000, "output": 50, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1500, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 2000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4000, "attrs": {"finish_reason": null, "ttft_ms": null, "usage": {"reported": false}}, "call_id": null, "call_index": null, "content": {}, "error": {"text": "connection reset by peer", "type": "network"}, "kind": "model", "message_id": null, "mono_ms": 4000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "error", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 4000, "last_message_id": "m4", "mono_ms": 4000, "session_id": "sess_A", "status": "error", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-12/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-12/expected-numbers.jsonnew file mode 100644index 00000000..8b3db88d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-12/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 3500,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 500,+ "total": 4000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1050+ },+ "by_purpose": {+ "main": 1050+ },+ "cache_share": 0.0,+ "failed_calls": 1,+ "overflow_calls": 0,+ "pill": 1050,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-12/expected-recording.json b/tests/corpora/observability/golden-phase1/M-12/expected-recording.jsonnew file mode 100644index 00000000..7ea66eaf--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-12/expected-recording.json@@ -0,0 +1,173 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": false,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 50,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "error": {+ "text": "connection reset by peer",+ "type": "network"+ },+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "error",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 4000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "error",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-13/events.jsonl b/tests/corpora/observability/golden-phase1/M-13/events.jsonlnew file mode 100644index 00000000..a088421d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-13/events.jsonl@@ -0,0 +1,10 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": false, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "email_send", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"decision": {"origin": "unattended_auto", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "auto_refused", "stage": "card"}]}, "result_bytes": null, "risk_class": "external", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 1000, "name": "email_send", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "denied", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 600, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 2500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 2500, "last_message_id": "m4", "mono_ms": 2500, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-13/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-13/expected-numbers.jsonnew file mode 100644index 00000000..b15595b1--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-13/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 500,+ "other_shown": true,+ "summary": 0,+ "tools": 0,+ "total": 2500,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1160+ },+ "by_purpose": {+ "main": 1160+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1160,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-13/expected-recording.json b/tests/corpora/observability/golden-phase1/M-13/expected-recording.jsonnew file mode 100644index 00000000..6c45f906--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-13/expected-recording.json@@ -0,0 +1,177 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "unattended_auto",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "auto_refused",+ "stage": "card"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "external",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": "m3",+ "name": "email_send",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "denied",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 600,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": false,+ "duration_ms": 2500,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-14/events.jsonl b/tests/corpora/observability/golden-phase1/M-14/events.jsonlnew file mode 100644index 00000000..271e2b2d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-14/events.jsonl@@ -0,0 +1,10 @@+{"at_ms": 0, "attrs": {"approval_mode": "plan", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "w1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "write_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"decision": {"origin": null, "path": [{"outcome": "denied", "stage": "permission"}]}, "result_bytes": null, "risk_class": "write_local", "sandbox": null}, "call_id": "w1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 1000, "name": "write_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "denied", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 600, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 2500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 2500, "last_message_id": "m4", "mono_ms": 2500, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-14/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-14/expected-numbers.jsonnew file mode 100644index 00000000..b15595b1--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-14/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 500,+ "other_shown": true,+ "summary": 0,+ "tools": 0,+ "total": 2500,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1160+ },+ "by_purpose": {+ "main": 1160+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1160,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-14/expected-recording.json b/tests/corpora/observability/golden-phase1/M-14/expected-recording.jsonnew file mode 100644index 00000000..a4da7040--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-14/expected-recording.json@@ -0,0 +1,173 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": null,+ "path": [+ {+ "outcome": "denied",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "write_local",+ "sandbox": null+ },+ "call_id": "w1",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": "m3",+ "name": "write_file",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "denied",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 600,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "plan",+ "attended": true,+ "duration_ms": 2500,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/M-17/events.jsonl b/tests/corpora/observability/golden-phase1/M-17/events.jsonlnew file mode 100644index 00000000..f5f7b20a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-17/events.jsonl@@ -0,0 +1,18 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": true}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 500, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1010, "attrs": {"attended": true, "for_call_id": "c1", "kind": "approval", "where": "session"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 1010, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1010, "attrs": {"mode": "shadow", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1010, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4500, "attrs": {"outcome": "approved"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 4500, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1010, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1010, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "c1", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1010, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": true, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1200, "attrs": {"finish_reason": null, "ttft_ms": null, "usage": {"reported": false}}, "call_id": "c1", "call_index": null, "content": {}, "error": {"text": "timeout", "type": "timeout"}, "kind": "model", "message_id": null, "mono_ms": 1200, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": true, "started_at": 1010, "status": "error", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4500, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 4500, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1200, "attrs": {"result": "could_not_run", "usage_reported": false}, "call_id": "c1", "call_index": 0, "content": {"reason": "reviewer error: RuntimeError"}, "kind": "auto_approver", "message_id": null, "mono_ms": 1200, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "started_at": 1010, "status": "error", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 5000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4500, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 6000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 600, "output": 30, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 6000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 6000, "last_message_id": "m4", "mono_ms": 6000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 6000, "attrs": {"matched_user": null}, "mono_ms": 6000, "session_id": "sess_A", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"at_ms": 6000, "content": {"resolved_by": "devika"}, "mono_ms": 6000, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/M-17/expected-numbers.json b/tests/corpora/observability/golden-phase1/M-17/expected-numbers.jsonnew file mode 100644index 00000000..207be6bb--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-17/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 10,+ "other_shown": false,+ "summary": 0,+ "tools": 500,+ "total": 6000,+ "waiting": 3490+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 1160+ },+ "by_purpose": {+ "main": 1160+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 1160,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/M-17/expected-recording.json b/tests/corpora/observability/golden-phase1/M-17/expected-recording.jsonnew file mode 100644index 00000000..81b0958b--- /dev/null+++ b/tests/corpora/observability/golden-phase1/M-17/expected-recording.json@@ -0,0 +1,276 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 500,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "error": {+ "text": "timeout",+ "type": "timeout"+ },+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": "c1",+ "call_index": null,+ "content": {},+ "duration_ms": 190,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 1010,+ "status": "error",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "matched_user": null,+ "mode": "shadow",+ "result": "could_not_run",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": false+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "reason": "reviewer error: RuntimeError"+ },+ "duration_ms": 190,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 1010,+ "status": "error",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c1",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 3490,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1010,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4500,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 600,+ "output": 30,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 6000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": true+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/README.md b/tests/corpora/observability/golden-phase1/README.mdnew file mode 100644index 00000000..13fc5904--- /dev/null+++ b/tests/corpora/observability/golden-phase1/README.md@@ -0,0 +1,98 @@+# Golden test, Phase 1++*Frozen 2026-10-31 with [recording-format.md](../../recording-format.md) version 1.0. Made by `phase-1/lab/make_golden.py`, checked by `phase-1/lab/check_golden.py`.*++## What the golden test is++**Context.** OpenWorker's observability is built twice: in the desktop app's Python engine now, and in the Rust harness SDK later. Both engines send the same five recording events (`turn_started`, `turn_ended`, `step_started`, `step_updated`, `step_ended`) to a recorder, which folds them into turns and steps. If both recorders fold the same events into the same recording, the app's screens, the token numbers and the export agree whichever engine ran the work. The golden test checks exactly that: **events in, recording out** (technical design §3.2 and §14, "The shared test").++Each scenario in this folder is one scripted run of the real engine from the Phase 1 lab ([phase-1/scenarios.md](../../phase-1/scenarios.md)), captured as:++| File | What it is |+|---|---|+| `<id>/events.jsonl` | Every recording event the run sent, one JSON object per line, in the order the recorder folded them |+| `<id>/expected-recording.json` | The recording the lab's recorder folded from them: `{"turns": [...], "steps": [...]}`, written by the lab's `canonical_json`, in recording format 1.0 |+| `<id>/expected-numbers.json` | Every number the Phase 1 screens show, computed from that recording by the lab's `calculator.py` |+| `index.json` | The scenario list: title, counts, known gaps, what is simulated, whether a second run sent its events in the same order |+| `vectors/` | The test vectors of recording-format.md in machine-readable form: `usage.json`, `raw-exchange-<wire>.json`, `piece-store.json` |++There are **30 scenarios**: S1-01 to S1-13, S1-16, and M-01a, M-01b, M-02 to M-05, M-06a, M-06c, M-07 to M-10, M-12 to M-14 and M-17.++**Not here.** Only scenarios that run a turn through the recorder produce events. The standalone scenarios S1-14 (machine and provider stamp), S1-15 (coworker fingerprint) and M-11 (token mapping) test small functions, not the recorder; S1-14 and S1-15 are covered by the stamp rules and M-11 by the usage test vectors in recording-format.md section 5 (and `vectors/usage.json`). S1-17 is a live-run checklist, not a scripted scenario.++## Format 1.0++**Context.** The files here are recording format 1.0. The lab recorder was brought to the format on 2026-10-31 and this folder was made again from it, so:+- the events in every `events.jsonl` are format 1.0 events (section 2 of recording-format.md): each has `v`, `at_ms` and `mono_ms`; content travels in its own `content` part; every `step_ended` carries a copy of the step's identity; `turn_started` carries `first_message_id`;+- every `expected-recording.json` stores `duration_ms` (never `ended_at`), `call_index`, the auto-approver's `result`, `schema_version` on each turn, and steps in the canonical order of section 4, with `seq` counted per turn;+- every expected recording and every event validates against [recording-format.schema.json](../../recording-format.schema.json): **30 of 30 recordings and 466 of 466 events** (`check_golden.py --schema`, which fails on any invalid file);+- `check_golden.py --design-order` re-sorts each recording by the canonical order as recording-format.md writes it: all 30 are in that order. S1-11 has one tie up to `name`, broken by rule 6 (the parent's `call_index`).++**What moved when the folder was made again.** The numbers (`expected-numbers.json`) did not change in any scenario. The step order changed only where the design's order rule says it must:+- S1-05 and S1-07: a refused tool call (zero-length) at the same millisecond as the next model call now comes before that call (zero-length first, M-R3);+- S1-10 and M-06a: a summary and its own model call, which start together, are now summary first (kind order `context, summary, model, …`);+- M-09 and M-10: no order within a turn changed, but steps are now listed turn by turn (the title call of M-10's first turn is listed with that turn).++There are fewer events than before (466, was 559): a step's `message_id` now arrives on its `step_ended`, so the separate `step_updated` events that carried it are gone.++## How a second engine uses it++1. For each scenario folder, read `events.jsonl` line by line. Each line is one event.+2. Pass the events, in file order, to a fresh recorder: no state from another scenario.+3. Write the folded recording as JSON: `{"turns": [...], "steps": [...]}`, turns sorted by `started_at` then `turn_id`, steps by `seq`.+4. Compare it with `expected-recording.json` by the rules below.+5. Compute the screen numbers from the recording and compare them with `expected-numbers.json`.++The Python reference does exactly this in `check_golden.py`, with only `recorder.py` and `calculator.py`: it does not need the OpenWorker engine.++## Comparison rules++- **Compare JSON values, not text.** Key order and whitespace do not matter; `1` and `1.0` are different values (counts and times are integers).+- **Ids are compared as they are**, with one renaming. Every id in a recording comes from the events (turn ids, step ids, call ids, message ids), so the same events give the same ids in any engine. But the lab's step ids come from a counter whose order depends on thread timing, so the lab's `canonical_json` renames every step id to `s1`, `s2`, … by the step's position in the file (turns in order, each turn's steps by `seq`, then steps of no turn), and renames `parent_step_id` and a summary's `attrs.model_step_id` the same way. A second engine comparing against these files applies the same renaming.+- **Times are compared exactly.** The scenarios are scripted, so every time is exact (milliseconds from 0). The design's "ignoring ids and exact times" applies to the second kind of test, which runs a real engine and checks the events it sends; that set is not in this folder yet.+- **`seq` is compared**, so the canonical order is tested too.+- **`cache_share`** is a fraction rounded to 3 decimals; `null` when no step reports a cache read.+- **Nothing else is ignored.**++**`expected-numbers.json`.** `usage` holds the session numbers (design §6.3): `pill` (the token pill), `at_least` (the "≥" marker), `unreported_calls`, `failed_calls`, `overflow_calls` (calls over the context limit), `by_purpose`, `by_model` (a non-main purpose is added to the key, for example `anthropic:claude-sonnet-5 (title)`), `cache_share`, and `auto_approver_checks_not_reported` (a Draft 4 count, 0 everywhere since TD-16). `usage_by_session` repeats them per session when a scenario has more than one (M-09). `buckets_by_turn` holds each turn's time buckets (design §7.1): `waiting`, `tools`, `model`, `auto_approver`, `summary`, `other`, `other_shown` and `total`, in milliseconds.++## How the events were captured++The events are exactly what the lab's engine hooks sent, in the order the recorder folded them; nothing is corrected afterwards. The lab sends `turn_started` once the turn's first message has been appended, so that it carries `first_message_id`; the turn's other events wait for it and keep the times at which they happened.++A few scenarios with work on several threads (S1-07, S1-11, M-17) send their events in a slightly different order from run to run, but every order folds into the same recording; the files hold one run's order, so regenerating them can reorder lines of their `events.jsonl` without changing the expected recording. `index.json` says, per scenario, whether the two runs of the last `make_golden.py` sent them in the same order (`events_identical_on_second_run`); for these three it depends on thread timing.++## Known gaps++**Context.** A known gap is a place where today's engine sends less than the design asks for, fixed by a listed engine change. In this test the events come from today's engine, so the expected recordings show the gap; the fold itself is correct and passes. When the engine change lands, the events change and this folder is regenerated.++| Where | Gap | What the files show today | Fixed by |+|---|---|---|---|+| S1-13 | V-04: the sandbox's `network_note()` returns hosts only, not counts, first times or `late` | `content.blocked` entries with `count`, `first_at` and `late` `null` (the format's "not reported"), and `attrs.sandbox.blocked_count: null` | E13 |+| M-07 | C-5: the bad-arguments `TOOL_FINISHED` event has no tool call id; the lab finds it from the transcript | Nothing in the recording, which is valid; the lab notes the fallback beside it, and the scripted check reports the gap | E1 |+| `vectors/usage.json`, from M-11 | V-20: the app ignores Ollama's `prompt_eval_cached_count` | The three Ollama vectors fail in `check_golden.py --vectors` | E3 |+| `vectors/usage.json`, from M-11 and the probe | V-21: the app does not read `cache_write_tokens` and subtract it | `openai-chat-probe-call-1` fails | E3 |+| `vectors/usage.json` | V-13 (a cache write of 0 recorded as not reported), V-15 (Anthropic thinking tokens not read) | Four more vectors fail | E3 |++The lab's `provider_facts` now has exactly the design's names, so the raw-exchange vectors pass for both `provider_meta` and `provider_facts` (their `lab_provider_facts_differs` lists are empty).++Simulated parts (decision-model reviewers, the sandbox, the title call, `resolved_by`, the trigger) are listed per scenario in `index.json`.++## How to regenerate and check++From `phase-1/lab/`, with openworker installed (`pip install -e <openworker checkout>[dev]`); on Windows set `PYTHONIOENCODING=utf-8`:++```bash+python make_golden.py # rewrite every scenario folder and index.json+python make_golden.py S1-03 # rewrite one scenario+python make_golden.py --vectors # rewrite vectors/ from the scripted values and the captured live runs+python check_golden.py # replay every scenario and compare; exit code 1 on any difference+python check_golden.py --schema # also validate every file against recording-format.schema.json (pip install jsonschema)+python check_golden.py --design-order # also re-sort by recording-format.md section 4 and report any difference+python check_shared_files.py # check attributes.yaml, the schema and recording-format.md agree (pip install pyyaml)+python check_golden.py --vectors # also run the test vectors through the app's code; known gaps reported+```++`make_golden.py` refuses to write a scenario unless replaying its captured events gives the run's own recording and numbers, a second run gives the same recording, and the events and recording validate against the schema. It never changes the lab's files or the runs in `phase-1/runs/`.++Any change to the golden files follows the change rule of recording-format.md section 7: a new format version, a changelog entry, regenerated files, and both engines updated.diff --git a/tests/corpora/observability/golden-phase1/S1-01/events.jsonl b/tests/corpora/observability/golden-phase1/S1-01/events.jsonlnew file mode 100644index 00000000..3625d3ab--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-01/events.jsonl@@ -0,0 +1,6 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 10, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7010, "attrs": {"finish_reason": "stop", "ttft_ms": 1900, "usage": {"cache_read": 22600, "cache_write": 2400, "input_fresh": 6200, "output": 610, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 7010, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 7020, "last_message_id": "m2", "mono_ms": 7020, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-01/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-01/expected-numbers.jsonnew file mode 100644index 00000000..a4c13f67--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-01/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 7000,+ "other": 20,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 7020,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 31810+ },+ "by_purpose": {+ "main": 31810+ },+ "cache_share": 0.724,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 31810,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-01/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-01/expected-recording.jsonnew file mode 100644index 00000000..d6d5f6d6--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-01/expected-recording.json@@ -0,0 +1,103 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": 1900,+ "usage": {+ "cache_read": 22600,+ "cache_write": 2400,+ "input_fresh": 6200,+ "output": 610,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 7000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 7020,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-02/events.jsonl b/tests/corpora/observability/golden-phase1/S1-02/events.jsonlnew file mode 100644index 00000000..41040801--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-02/events.jsonl@@ -0,0 +1,14 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 8000, "cache_write": null, "input_fresh": 2000, "output": 300, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2000, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2300, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 2300, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2300, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 2300, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3800, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 10000, "cache_write": null, "input_fresh": 500, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 3800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2300, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3800, "attrs": {}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 3800, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m5", "mono_ms": 4100, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3800, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 4100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5600, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 10400, "cache_write": null, "input_fresh": 600, "output": 400, "reasoning": 120, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 5600, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4100, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 5600, "last_message_id": "m6", "mono_ms": 5600, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-02/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-02/expected-numbers.jsonnew file mode 100644index 00000000..62515c12--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-02/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 5000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 600,+ "total": 5600,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "openai:gpt-5.1": 32400+ },+ "by_purpose": {+ "main": 32400+ },+ "cache_share": 0.902,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 32400,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-02/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-02/expected-recording.jsonnew file mode 100644index 00000000..a3a3b5b8--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-02/expected-recording.json@@ -0,0 +1,245 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "tool_calls",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 8000,+ "cache_write": null,+ "input_fresh": 2000,+ "output": 300,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 300,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "tool_calls",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 10000,+ "cache_write": null,+ "input_fresh": 500,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2300,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {},+ "duration_ms": 300,+ "kind": "tool",+ "message_id": "m5",+ "name": "read_file",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3800,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 10400,+ "cache_write": null,+ "input_fresh": 600,+ "output": 400,+ "reasoning": 120,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4100,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 5600,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m6",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-03/events.jsonl b/tests/corpora/observability/golden-phase1/S1-03/events.jsonlnew file mode 100644index 00000000..4c081ab1--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-03/events.jsonl@@ -0,0 +1,12 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": null, "input_fresh": 5000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1500, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {}, "call_id": "c2", "call_index": 1, "content": {}, "kind": "tool", "mono_ms": 1500, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2100, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 2100, "name": "grep", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c2", "call_index": 1, "content": {}, "kind": "tool", "message_id": "m4", "mono_ms": 3500, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1500, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 3500, "attrs": {"context_window": null, "model": "openai:gpt-5.1", "provider": "openai", "provider_title": "OpenAI", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 3500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 4864, "cache_write": null, "input_fresh": 1136, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m5", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 3500, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 5000, "last_message_id": "m5", "mono_ms": 5000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-03/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-03/expected-numbers.jsonnew file mode 100644index 00000000..45c66ffd--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-03/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 3000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 2000,+ "total": 5000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "openai:gpt-5.1": 11300+ },+ "by_purpose": {+ "main": 11300+ },+ "cache_share": 0.442,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 11300,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-03/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-03/expected-recording.jsonnew file mode 100644index 00000000..99a8714f--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-03/expected-recording.json@@ -0,0 +1,207 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "tool_calls",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": null,+ "input_fresh": 5000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 600,+ "kind": "tool",+ "message_id": "m3",+ "name": "grep",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c2",+ "call_index": 1,+ "content": {},+ "duration_ms": 2000,+ "kind": "tool",+ "message_id": "m4",+ "name": "read_file",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1500,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "openai:gpt-5.1",+ "provider": "openai",+ "provider_title": "OpenAI",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 4864,+ "cache_write": null,+ "input_fresh": 1136,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m5",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 3500,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 5000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m5",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-04/events.jsonl b/tests/corpora/observability/golden-phase1/S1-04/events.jsonlnew file mode 100644index 00000000..2d8ea897--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-04/events.jsonl@@ -0,0 +1,13 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 3000, "input_fresh": 3000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 2000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2010, "attrs": {"attended": true, "for_call_id": "c1", "kind": "approval", "where": "session"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 2010, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 136010, "attrs": {"outcome": "approved"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 136010, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2010, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 136010, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 136010, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 136510, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 136510, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 136010, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 136510, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 136510, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 138010, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 3000, "cache_write": 300, "input_fresh": 200, "output": 150, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 138010, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 136510, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 138010, "last_message_id": "m4", "mono_ms": 138010, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 138010, "content": {"resolved_by": "devika"}, "mono_ms": 138010, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-04/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-04/expected-numbers.jsonnew file mode 100644index 00000000..8e2ff1d5--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-04/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 3500,+ "other": 10,+ "other_shown": false,+ "summary": 0,+ "tools": 500,+ "total": 138010,+ "waiting": 134000+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 9750+ },+ "by_purpose": {+ "main": 9750+ },+ "cache_share": 0.316,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 9750,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-04/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-04/expected-recording.jsonnew file mode 100644index 00000000..300fb332--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-04/expected-recording.json@@ -0,0 +1,208 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 3000,+ "input_fresh": 3000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c1",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 134000,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2010,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 136010,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 3000,+ "cache_write": 300,+ "input_fresh": 200,+ "output": 150,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 136510,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 138010,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-05/events.jsonl b/tests/corpora/observability/golden-phase1/S1-05/events.jsonlnew file mode 100644index 00000000..b1d2954a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-05/events.jsonl@@ -0,0 +1,33 @@+{"at_ms": 0, "attrs": {"approval_mode": "auto-approve", "attended": true, "reviewer": {"active": true, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 18000, "cache_write": 0, "input_fresh": 2100, "output": 150, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "a", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1800, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "a", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1800, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 1600, "cache_write": 0, "input_fresh": 400, "output": 40, "reasoning": null, "reported": true}}, "call_id": "a", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 2700, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {"breaker": {"denials_in_row": 0, "tripped": false}, "result": "allow", "usage_reported": true}, "call_id": "a", "call_index": 0, "content": {"reason": "Runs a local scanner inside the workspace"}, "kind": "auto_approver", "message_id": null, "mono_ms": 2700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {}, "call_id": "a", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 43700, "attrs": {"decision": {"origin": "reviewer", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "allow", "stage": "auto_approver"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "a", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 43700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2700, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 43700, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 43700, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 45100, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 20000, "cache_write": 0, "input_fresh": 900, "output": 120, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 45100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 43700, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 45100, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "b", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 45100, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 45100, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "b", "call_index": null, "content": {}, "kind": "model", "mono_ms": 45100, "name": "model", "parent_step_id": "step_7", "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 46000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 1600, "cache_write": 0, "input_fresh": 420, "output": 55, "reasoning": null, "reported": true}}, "call_id": "b", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 46000, "name": "model", "parent_step_id": "step_7", "session_id": "sess_A", "shadow": false, "started_at": 45100, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 46000, "attrs": {"breaker": {"denials_in_row": 1, "tripped": false}, "result": "deny", "usage_reported": true}, "call_id": "b", "call_index": 0, "content": {"reason": "Deletes files outside the request"}, "kind": "auto_approver", "message_id": null, "mono_ms": 46000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 45100, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 46000, "attrs": {}, "call_id": "b", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 46000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 46000, "attrs": {"decision": {"origin": "reviewer_denied", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "deny", "stage": "auto_approver"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "b", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 46000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 46000, "status": "denied", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 46000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 46000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 47500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 21000, "cache_write": 0, "input_fresh": 700, "output": 160, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 47500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 46000, "status": "ok", "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 47500, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "c", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 47500, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 47500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "c", "call_index": null, "content": {}, "kind": "model", "mono_ms": 47500, "name": "model", "parent_step_id": "step_11", "session_id": "sess_A", "shadow": false, "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 48800, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 1600, "cache_write": 0, "input_fresh": 450, "output": 60, "reasoning": null, "reported": true}}, "call_id": "c", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 48800, "name": "model", "parent_step_id": "step_11", "session_id": "sess_A", "shadow": false, "started_at": 47500, "status": "ok", "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 48800, "attrs": {"breaker": {"denials_in_row": 0, "tripped": false}, "result": "unsure", "usage_reported": true}, "call_id": "c", "call_index": 0, "content": {"reason": "Opens a PR on a shared repo"}, "kind": "auto_approver", "message_id": null, "mono_ms": 48800, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 47500, "status": "ok", "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 48800, "attrs": {"attended": true, "for_call_id": "c", "kind": "approval", "where": "session"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 48800, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_13", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 108800, "attrs": {"outcome": "approved"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 108800, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 48800, "status": "ok", "step_id": "step_13", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 108800, "attrs": {}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 108800, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_14", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 110800, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "unsure", "stage": "auto_approver"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "external", "sandbox": null}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m7", "mono_ms": 110800, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 108800, "status": "ok", "step_id": "step_14", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 110800, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 110800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_15", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 113800, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 22000, "cache_write": 0, "input_fresh": 800, "output": 300, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m8", "mono_ms": 113800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 110800, "status": "ok", "step_id": "step_15", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 113800, "last_message_id": "m8", "mono_ms": 113800, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 113800, "content": {"resolved_by": "devika"}, "mono_ms": 113800, "session_id": "sess_A", "step_id": "step_13", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-05/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-05/expected-numbers.jsonnew file mode 100644index 00000000..2b6d6e7d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-05/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 3100,+ "model": 7700,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 43000,+ "total": 113800,+ "waiting": 60000+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 86230,+ "anthropic:claude-sonnet-5 (auto_approver)": 6225+ },+ "by_purpose": {+ "auto_approver": 6225,+ "main": 86230+ },+ "cache_share": 0.937,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 92455,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-05/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-05/expected-recording.jsonnew file mode 100644index 00000000..afa388e7--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-05/expected-recording.json@@ -0,0 +1,588 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 18000,+ "cache_write": 0,+ "input_fresh": 2100,+ "output": 150,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1800,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 1600,+ "cache_write": 0,+ "input_fresh": 400,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "a",+ "call_index": null,+ "content": {},+ "duration_ms": 900,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 0,+ "tripped": false+ },+ "mode": "live",+ "result": "allow",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "a",+ "call_index": 0,+ "content": {+ "reason": "Runs a local scanner inside the workspace"+ },+ "duration_ms": 900,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "allow",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "a",+ "call_index": 0,+ "content": {},+ "duration_ms": 41000,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2700,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 20000,+ "cache_write": 0,+ "input_fresh": 900,+ "output": 120,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1400,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 43700,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 1600,+ "cache_write": 0,+ "input_fresh": 420,+ "output": 55,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "b",+ "call_index": null,+ "content": {},+ "duration_ms": 900,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s8",+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 45100,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 1,+ "tripped": false+ },+ "mode": "live",+ "result": "deny",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "b",+ "call_index": 0,+ "content": {+ "reason": "Deletes files outside the request"+ },+ "duration_ms": 900,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 8,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 45100,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer_denied",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "deny",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "b",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 9,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 46000,+ "status": "denied",+ "step_id": "s9",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 21000,+ "cache_write": 0,+ "input_fresh": 700,+ "output": 160,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 10,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 46000,+ "status": "ok",+ "step_id": "s10",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 1600,+ "cache_write": 0,+ "input_fresh": 450,+ "output": 60,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "c",+ "call_index": null,+ "content": {},+ "duration_ms": 1300,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s12",+ "seq": 11,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 47500,+ "status": "ok",+ "step_id": "s11",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 0,+ "tripped": false+ },+ "mode": "live",+ "result": "unsure",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "c",+ "call_index": 0,+ "content": {+ "reason": "Opens a PR on a shared repo"+ },+ "duration_ms": 1300,+ "kind": "auto_approver",+ "message_id": null,+ "name": "github_create_pr",+ "parent_step_id": null,+ "seq": 12,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 47500,+ "status": "ok",+ "step_id": "s12",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 60000,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 13,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 48800,+ "status": "ok",+ "step_id": "s13",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "unsure",+ "stage": "auto_approver"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "external",+ "sandbox": null+ },+ "call_id": "c",+ "call_index": 0,+ "content": {},+ "duration_ms": 2000,+ "kind": "tool",+ "message_id": "m7",+ "name": "github_create_pr",+ "parent_step_id": null,+ "seq": 14,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 108800,+ "status": "ok",+ "step_id": "s14",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 22000,+ "cache_write": 0,+ "input_fresh": 800,+ "output": 300,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": "m8",+ "name": "model",+ "parent_step_id": null,+ "seq": 15,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 110800,+ "status": "ok",+ "step_id": "s15",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "auto-approve",+ "attended": true,+ "duration_ms": 113800,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m8",+ "reviewer": {+ "active": true,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-06/events.jsonl b/tests/corpora/observability/golden-phase1/S1-06/events.jsonlnew file mode 100644index 00000000..11db6130--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-06/events.jsonl@@ -0,0 +1,14 @@+{"at_ms": 0, "attrs": {"approval_mode": "auto-approve", "attended": true, "reviewer": {"active": true, "kind": "typesafe_jev", "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 18000, "cache_write": 0, "input_fresh": 2100, "output": 150, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"mode": "live", "reviewer": {"external": true, "kind": "typesafe_jev", "model": null}}, "call_id": "a", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1800, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"context_window": null, "model": "typesafe_jev:decision", "provider": "typesafe_jev", "provider_title": null, "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "a", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1800, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": null, "cache_write": null, "input_fresh": 6203, "output": 529, "reasoning": null, "reported": true}}, "call_id": "a", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 2700, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {"breaker": {"denials_in_row": 0, "tripped": false}, "cutoff": 0.9, "result": "allow", "score": 0.94, "usage_reported": true}, "call_id": "a", "call_index": 0, "content": {"questions": [{"a": "yes", "q": "Does the action do what the user asked?", "score": 0.97}, {"a": "no", "q": "Did the agent pick the target itself?", "score": 0.96}, {"a": "no", "q": "Did the agent choose the time?", "score": 0.99}, {"a": "no", "q": "Does it send data off the machine?", "score": 0.94}], "reason": ""}, "kind": "auto_approver", "message_id": null, "mono_ms": 2700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 2700, "attrs": {}, "call_id": "a", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 2700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 43700, "attrs": {"decision": {"origin": "reviewer", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "allow", "stage": "auto_approver"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "a", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 43700, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 2700, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 43700, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 43700, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 45100, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 20000, "cache_write": 0, "input_fresh": 900, "output": 120, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 45100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 43700, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 45100, "last_message_id": "m4", "mono_ms": 45100, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-06/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-06/expected-numbers.jsonnew file mode 100644index 00000000..ad8064c8--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-06/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 900,+ "model": 3200,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 41000,+ "total": 45100,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 41270,+ "typesafe_jev:decision (auto_approver)": 6732+ },+ "by_purpose": {+ "auto_approver": 6732,+ "main": 41270+ },+ "cache_share": 0.927,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 48002,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-06/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-06/expected-recording.jsonnew file mode 100644index 00000000..3e32e9b4--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-06/expected-recording.json@@ -0,0 +1,277 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 18000,+ "cache_write": 0,+ "input_fresh": 2100,+ "output": 150,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1800,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": null,+ "finish_reason": "stop",+ "model": "typesafe_jev:decision",+ "provider": "typesafe_jev",+ "provider_title": null,+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": null,+ "cache_write": null,+ "input_fresh": 6203,+ "output": 529,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "a",+ "call_index": null,+ "content": {},+ "duration_ms": 900,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 0,+ "tripped": false+ },+ "cutoff": 0.9,+ "mode": "live",+ "result": "allow",+ "reviewer": {+ "external": true,+ "kind": "typesafe_jev",+ "model": null+ },+ "score": 0.94,+ "usage_reported": true+ },+ "call_id": "a",+ "call_index": 0,+ "content": {+ "questions": [+ {+ "a": "yes",+ "q": "Does the action do what the user asked?",+ "score": 0.97+ },+ {+ "a": "no",+ "q": "Did the agent pick the target itself?",+ "score": 0.96+ },+ {+ "a": "no",+ "q": "Did the agent choose the time?",+ "score": 0.99+ },+ {+ "a": "no",+ "q": "Does it send data off the machine?",+ "score": 0.94+ }+ ],+ "reason": ""+ },+ "duration_ms": 900,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "reviewer",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "allow",+ "stage": "auto_approver"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "a",+ "call_index": 0,+ "content": {},+ "duration_ms": 41000,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 2700,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 20000,+ "cache_write": 0,+ "input_fresh": 900,+ "output": 120,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1400,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 43700,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "auto-approve",+ "attended": true,+ "duration_ms": 45100,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": true,+ "kind": "typesafe_jev",+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-07/events.jsonl b/tests/corpora/observability/golden-phase1/S1-07/events.jsonlnew file mode 100644index 00000000..0882efb8--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-07/events.jsonl@@ -0,0 +1,30 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": true}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1500, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 4900, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1510, "attrs": {"attended": true, "for_call_id": "c1", "kind": "approval", "where": "session"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 1510, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1510, "attrs": {"mode": "shadow", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1510, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 39510, "attrs": {"outcome": "denied"}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 39510, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1510, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 39510, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 39510, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 39510, "attrs": {"decision": {"origin": null, "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "denied", "stage": "resolved"}]}, "result_bytes": null, "risk_class": "exec", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 39510, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 39510, "status": "denied", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1510, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "c1", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1510, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": true, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2900, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 1600, "cache_write": 0, "input_fresh": 300, "output": 40, "reasoning": null, "reported": true}}, "call_id": "c1", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 2900, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": true, "started_at": 1510, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 39510, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 39510, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 2900, "attrs": {"result": "allow", "usage_reported": true}, "call_id": "c1", "call_index": 0, "content": {"reason": "fine"}, "kind": "auto_approver", "message_id": null, "mono_ms": 2900, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "started_at": 1510, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 41010, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 4700, "cache_write": 0, "input_fresh": 200, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 41010, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 39510, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 41020, "attrs": {"attended": true, "for_call_id": "c2", "kind": "approval", "where": "session"}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 41020, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 41020, "attrs": {"mode": "shadow", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 41020, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 51020, "attrs": {"outcome": "approved"}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 51020, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 41020, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 41020, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "c2", "call_index": null, "content": {}, "kind": "model", "mono_ms": 41020, "name": "model", "parent_step_id": "step_9", "session_id": "sess_A", "shadow": true, "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 42300, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 1600, "cache_write": 0, "input_fresh": 300, "output": 40, "reasoning": null, "reported": true}}, "call_id": "c2", "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 42300, "name": "model", "parent_step_id": "step_9", "session_id": "sess_A", "shadow": true, "started_at": 41020, "status": "ok", "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 51020, "attrs": {}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 51020, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 42300, "attrs": {"result": "allow", "usage_reported": true}, "call_id": "c2", "call_index": 0, "content": {"reason": "fine"}, "kind": "auto_approver", "message_id": null, "mono_ms": 42300, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": true, "started_at": 41020, "status": "ok", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 51520, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "exec", "sandbox": null}, "call_id": "c2", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m5", "mono_ms": 51520, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 51020, "status": "ok", "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 51520, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 51520, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 53020, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 4600, "cache_write": 0, "input_fresh": 300, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m6", "mono_ms": 53020, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 51520, "status": "ok", "step_id": "step_12", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 53020, "last_message_id": "m6", "mono_ms": 53020, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 53020, "attrs": {"matched_user": false}, "mono_ms": 53020, "session_id": "sess_A", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"at_ms": 53020, "attrs": {"matched_user": true}, "mono_ms": 53020, "session_id": "sess_A", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"at_ms": 53020, "content": {"resolved_by": "devika"}, "mono_ms": 53020, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"at_ms": 53020, "content": {"resolved_by": "devika"}, "mono_ms": 53020, "session_id": "sess_A", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-07/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-07/expected-numbers.jsonnew file mode 100644index 00000000..e428363a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-07/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 4500,+ "other": 20,+ "other_shown": false,+ "summary": 0,+ "tools": 500,+ "total": 53020,+ "waiting": 48000+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 15000,+ "anthropic:claude-sonnet-5 (auto_approver)": 3880+ },+ "by_purpose": {+ "auto_approver": 3880,+ "main": 15000+ },+ "cache_share": 0.676,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 18880,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-07/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-07/expected-recording.jsonnew file mode 100644index 00000000..042f339a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-07/expected-recording.json@@ -0,0 +1,451 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 4900,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 1600,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "c1",+ "call_index": null,+ "content": {},+ "duration_ms": 1390,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 1510,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "matched_user": false,+ "mode": "shadow",+ "result": "allow",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "reason": "fine"+ },+ "duration_ms": 1390,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 1510,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c1",+ "kind": "approval",+ "outcome": "denied",+ "where": "session"+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 38000,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1510,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": null,+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "denied",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": null,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 0,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 39510,+ "status": "denied",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 4700,+ "cache_write": 0,+ "input_fresh": 200,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 39510,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 1600,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 40,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": "c2",+ "call_index": null,+ "content": {},+ "duration_ms": 1280,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s9",+ "seq": 8,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 41020,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "matched_user": true,+ "mode": "shadow",+ "result": "allow",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": true+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {+ "reason": "fine"+ },+ "duration_ms": 1280,+ "kind": "auto_approver",+ "message_id": null,+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 9,+ "session_id": "sess_A",+ "shadow": true,+ "started_at": 41020,+ "status": "ok",+ "step_id": "s9",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c2",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 10000,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 10,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 41020,+ "status": "ok",+ "step_id": "s10",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "exec",+ "sandbox": null+ },+ "call_id": "c2",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m5",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 11,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 51020,+ "status": "ok",+ "step_id": "s11",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 4600,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1500,+ "kind": "model",+ "message_id": "m6",+ "name": "model",+ "parent_step_id": null,+ "seq": 12,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 51520,+ "status": "ok",+ "step_id": "s12",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 53020,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m6",+ "reviewer": {+ "active": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": true+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-08/events.jsonl b/tests/corpora/observability/golden-phase1/S1-08/events.jsonlnew file mode 100644index 00000000..bfc881a0--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-08/events.jsonl@@ -0,0 +1,17 @@+{"at_ms": 0, "attrs": {"approval_mode": "auto-approve", "attended": true, "reviewer": {"active": true, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1800, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"mode": "live", "reviewer": {"external": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5"}}, "call_id": "c", "call_index": 0, "content": {}, "kind": "auto_approver", "mono_ms": 1800, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "auto_approver", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": "c", "call_index": null, "content": {}, "kind": "model", "mono_ms": 1800, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"finish_reason": null, "ttft_ms": null, "usage": {"reported": false}}, "call_id": "c", "call_index": null, "content": {}, "error": {"text": "no_api_key", "type": "auth"}, "kind": "model", "message_id": null, "mono_ms": 1800, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "error", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1800, "attrs": {"breaker": {"denials_in_row": 0, "tripped": false}, "result": "could_not_run", "usage_reported": false}, "call_id": "c", "call_index": 0, "content": {"reason": "reviewer error: RuntimeError"}, "kind": "auto_approver", "message_id": null, "mono_ms": 1800, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1800, "status": "error", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1810, "attrs": {"attended": true, "for_call_id": "c", "kind": "approval", "where": "session"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 1810, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 20000, "attrs": {"outcome": "approved"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 20000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1810, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 20000, "attrs": {}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 20000, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 21000, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "could_not_run", "stage": "auto_approver"}, {"outcome": "shown_session", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "external", "sandbox": null}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 21000, "name": "github_create_pr", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 20000, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 21000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 21000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 22000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1200, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 22000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 21000, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 22000, "last_message_id": "m4", "mono_ms": 22000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 22000, "content": {"resolved_by": "devika"}, "mono_ms": 22000, "session_id": "sess_A", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-08/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-08/expected-numbers.jsonnew file mode 100644index 00000000..533b86e3--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-08/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2800,+ "other": 10,+ "other_shown": false,+ "summary": 0,+ "tools": 1000,+ "total": 22000,+ "waiting": 18190+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 2400+ },+ "by_purpose": {+ "main": 2400+ },+ "cache_share": 0.0,+ "failed_calls": 1,+ "overflow_calls": 0,+ "pill": 2400,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-08/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-08/expected-recording.jsonnew file mode 100644index 00000000..1368f544--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-08/expected-recording.json@@ -0,0 +1,287 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1800,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "error": {+ "text": "no_api_key",+ "type": "auth"+ },+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "auto_approver",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": "c",+ "call_index": null,+ "content": {},+ "duration_ms": 0,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "error",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "breaker": {+ "denials_in_row": 0,+ "tripped": false+ },+ "mode": "live",+ "result": "could_not_run",+ "reviewer": {+ "external": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5"+ },+ "usage_reported": false+ },+ "call_id": "c",+ "call_index": 0,+ "content": {+ "reason": "reviewer error: RuntimeError"+ },+ "duration_ms": 0,+ "kind": "auto_approver",+ "message_id": null,+ "name": "github_create_pr",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1800,+ "status": "error",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": true,+ "for_call_id": "c",+ "kind": "approval",+ "outcome": "approved",+ "where": "session"+ },+ "call_id": "c",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 18190,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1810,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "could_not_run",+ "stage": "auto_approver"+ },+ {+ "outcome": "shown_session",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "external",+ "sandbox": null+ },+ "call_id": "c",+ "call_index": 0,+ "content": {},+ "duration_ms": 1000,+ "kind": "tool",+ "message_id": "m3",+ "name": "github_create_pr",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 20000,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1200,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 21000,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "auto-approve",+ "attended": true,+ "duration_ms": 22000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": true,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-09/events.jsonl b/tests/corpora/observability/golden-phase1/S1-09/events.jsonlnew file mode 100644index 00000000..54bf9d58--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-09/events.jsonl@@ -0,0 +1,12 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 3000, "attrs": {"finish_reason": null, "ttft_ms": null, "usage": {"reported": false}}, "call_id": null, "call_index": null, "content": {}, "error": {"text": "overloaded_529", "type": "overloaded"}, "kind": "model", "message_id": null, "mono_ms": 3000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "error", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 3000, "last_message_id": "m2", "mono_ms": 3000, "session_id": "sess_A", "status": "error", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 5000, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m3", "kind": "retry", "mono_ms": 5000, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_2", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 5000, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_2", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5005, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5005, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_2", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_2", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 5000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m3", "mono_ms": 7000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_2", "type": "step_ended", "v": 1}+{"at_ms": 7000, "last_message_id": "m3", "mono_ms": 7000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_2", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-09/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-09/expected-numbers.jsonnew file mode 100644index 00000000..803d79ab--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-09/expected-numbers.json@@ -0,0 +1,39 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 3000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 3000,+ "waiting": 0+ },+ "sess_A:turn_2": {+ "auto_approver": 0,+ "model": 2000,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 2000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 5100+ },+ "by_purpose": {+ "main": 5100+ },+ "cache_share": 0.0,+ "failed_calls": 1,+ "overflow_calls": 0,+ "pill": 5100,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-09/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-09/expected-recording.jsonnew file mode 100644index 00000000..1590b78a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-09/expected-recording.json@@ -0,0 +1,193 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "error": {+ "text": "overloaded_529",+ "type": "overloaded"+ },+ "finish_reason": null,+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "reported": false+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "error",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_2"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 5000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m3",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_2"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 3000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "error",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ },+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 2000,+ "first_message_id": "m3",+ "incomplete": false,+ "kind": "retry",+ "last_message_id": "m3",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 2,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 5000,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_2"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-10/events.jsonl b/tests/corpora/observability/golden-phase1/S1-10/events.jsonlnew file mode 100644index 00000000..f0a539a3--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-10/events.jsonl@@ -0,0 +1,15 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m13", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 45000, "cache_write": 0, "input_fresh": 2000, "output": 300, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m14", "mono_ms": 4000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 4000, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 12, "risk_class": "read", "sandbox": null}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m15", "mono_ms": 5000, "name": "read_file", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "summary", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 5000, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 8200, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 48000, "output": 1200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 8200, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"model_step_id": "step_5", "reason": "threshold", "tokens_before": 47000}, "call_id": null, "call_index": null, "content": {}, "kind": "summary", "mono_ms": 5000, "name": "summary", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 8200, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "summary", "message_id": null, "mono_ms": 8200, "name": "summary", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 8200, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 8200, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"at_ms": 10200, "attrs": {"tokens_after": 6500}, "mono_ms": 10200, "session_id": "sess_A", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}+{"after_turn": false, "at_ms": 10200, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 6500, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m17", "mono_ms": 10200, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 8200, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 10200, "last_message_id": "m17", "mono_ms": 10200, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-10/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-10/expected-numbers.jsonnew file mode 100644index 00000000..0e3729f9--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-10/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 6000,+ "other": 0,+ "other_shown": false,+ "summary": 3200,+ "tools": 1000,+ "total": 10200,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 54000,+ "anthropic:claude-sonnet-5 (summary)": 49200+ },+ "by_purpose": {+ "main": 54000,+ "summary": 49200+ },+ "cache_share": 0.443,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 103200,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-10/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-10/expected-recording.jsonnew file mode 100644index 00000000..7af8d1fc--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-10/expected-recording.json@@ -0,0 +1,236 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 45000,+ "cache_write": 0,+ "input_fresh": 2000,+ "output": 300,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 4000,+ "kind": "model",+ "message_id": "m14",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {},+ "duration_ms": 1000,+ "kind": "tool",+ "message_id": "m15",+ "name": "read_file",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "model_step_id": "s5",+ "reason": "threshold",+ "tokens_after": 6500,+ "tokens_before": 47000+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3200,+ "kind": "summary",+ "message_id": null,+ "name": "summary",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "summary",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 48000,+ "output": 1200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3200,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 6500,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2000,+ "kind": "model",+ "message_id": "m17",+ "name": "model",+ "parent_step_id": null,+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 8200,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 10200,+ "first_message_id": "m13",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m17",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-11/events.jsonl b/tests/corpora/observability/golden-phase1/S1-11/events.jsonlnew file mode 100644index 00000000..ef2dbbc0--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-11/events.jsonl@@ -0,0 +1,24 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "35497d", "tools_offered": 7}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1900, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 6900, "cache_write": 0, "input_fresh": 1000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1900, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1900, "attrs": {}, "call_id": "e1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1900, "name": "explore", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1900, "attrs": {}, "call_id": "e2", "call_index": 1, "content": {}, "kind": "tool", "mono_ms": 1900, "name": "explore", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1950, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "helper", "stream": true, "tools_hash": "fd36a2", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1950, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4950, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 3000, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 4950, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "started_at": 1950, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1950, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "helper", "stream": true, "tools_hash": "fd36a2", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 1950, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4750, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 3000, "output": 200, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 4750, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 1950, "status": "ok", "step_id": "step_6", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4950, "attrs": {}, "call_id": "hb1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 4950, "name": "read_file", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4750, "attrs": {}, "call_id": "ha1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 4750, "name": "read_file", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"decision": {"helper": true}, "result_bytes": 33, "risk_class": "read", "sandbox": null}, "call_id": "hb1", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 7000, "name": "read_file", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "started_at": 4950, "status": "ok", "step_id": "step_7", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 8350, "attrs": {"decision": {"helper": true}, "result_bytes": 35, "risk_class": "read", "sandbox": null}, "call_id": "ha1", "call_index": 0, "content": {}, "kind": "tool", "message_id": null, "mono_ms": 8350, "name": "read_file", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 4750, "status": "ok", "step_id": "step_8", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 7000, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "helper", "stream": true, "tools_hash": "fd36a2", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 7000, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 26850, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 3000, "cache_write": 0, "input_fresh": 8000, "output": 700, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 26850, "name": "model", "parent_step_id": "step_4", "session_id": "sess_A", "shadow": false, "started_at": 7000, "status": "ok", "step_id": "step_9", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 8350, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "helper", "stream": true, "tools_hash": "fd36a2", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 8350, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 30850, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 3000, "cache_write": 0, "input_fresh": 9000, "output": 800, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 30850, "name": "model", "parent_step_id": "step_3", "session_id": "sess_A", "shadow": false, "started_at": 8350, "status": "ok", "step_id": "step_10", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 30900, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 22, "risk_class": "read", "sandbox": null}, "call_id": "e1", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 30900, "name": "explore", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1900, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 26900, "attrs": {"decision": {"origin": "low_risk", "path": [{"detail": "low_risk", "outcome": "allowed", "stage": "permission"}]}, "result_bytes": 22, "risk_class": "read", "sandbox": null}, "call_id": "e2", "call_index": 1, "content": {}, "kind": "tool", "message_id": "m4", "mono_ms": 26900, "name": "explore", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1900, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 30900, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "35497d", "tools_offered": 7}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 30900, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 47900, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 8000, "cache_write": 0, "input_fresh": 2000, "output": 400, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m5", "mono_ms": 47900, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 30900, "status": "ok", "step_id": "step_11", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 47900, "last_message_id": "m5", "mono_ms": 47900, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-11/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-11/expected-numbers.jsonnew file mode 100644index 00000000..08088ce5--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-11/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 18900,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 29000,+ "total": 47900,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 18400,+ "anthropic:claude-sonnet-5 (helper)": 30900+ },+ "by_purpose": {+ "helper": 30900,+ "main": 18400+ },+ "cache_share": 0.446,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 49300,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-11/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-11/expected-recording.jsonnew file mode 100644index 00000000..903710ae--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-11/expected-recording.json@@ -0,0 +1,411 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "35497d",+ "tools_offered": 7,+ "ttft_ms": null,+ "usage": {+ "cache_read": 6900,+ "cache_write": 0,+ "input_fresh": 1000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1900,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 22,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "e1",+ "call_index": 0,+ "content": {},+ "duration_ms": 29000,+ "kind": "tool",+ "message_id": "m3",+ "name": "explore",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1900,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "low_risk",+ "path": [+ {+ "detail": "low_risk",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "result_bytes": 22,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "e2",+ "call_index": 1,+ "content": {},+ "duration_ms": 25000,+ "kind": "tool",+ "message_id": "m4",+ "name": "explore",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1900,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "helper",+ "stream": true,+ "tools_hash": "fd36a2",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 3000,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 2800,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s3",+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1950,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "helper",+ "stream": true,+ "tools_hash": "fd36a2",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 3000,+ "output": 200,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 3000,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 6,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1950,+ "status": "ok",+ "step_id": "s6",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "helper": true+ },+ "result_bytes": 35,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "ha1",+ "call_index": 0,+ "content": {},+ "duration_ms": 3600,+ "kind": "tool",+ "message_id": null,+ "name": "read_file",+ "parent_step_id": "s3",+ "seq": 7,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4750,+ "status": "ok",+ "step_id": "s7",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "helper": true+ },+ "result_bytes": 33,+ "risk_class": "read",+ "sandbox": null+ },+ "call_id": "hb1",+ "call_index": 0,+ "content": {},+ "duration_ms": 2050,+ "kind": "tool",+ "message_id": null,+ "name": "read_file",+ "parent_step_id": "s4",+ "seq": 8,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4950,+ "status": "ok",+ "step_id": "s8",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "helper",+ "stream": true,+ "tools_hash": "fd36a2",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 3000,+ "cache_write": 0,+ "input_fresh": 8000,+ "output": 700,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 19850,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s4",+ "seq": 9,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7000,+ "status": "ok",+ "step_id": "s9",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "helper",+ "stream": true,+ "tools_hash": "fd36a2",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 3000,+ "cache_write": 0,+ "input_fresh": 9000,+ "output": 800,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 22500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": "s3",+ "seq": 10,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 8350,+ "status": "ok",+ "step_id": "s10",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "35497d",+ "tools_offered": 7,+ "ttft_ms": null,+ "usage": {+ "cache_read": 8000,+ "cache_write": 0,+ "input_fresh": 2000,+ "output": 400,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 17000,+ "kind": "model",+ "message_id": "m5",+ "name": "model",+ "parent_step_id": null,+ "seq": 11,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 30900,+ "status": "ok",+ "step_id": "s11",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 47900,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m5",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-12/events.jsonl b/tests/corpora/observability/golden-phase1/S1-12/events.jsonlnew file mode 100644index 00000000..231730f9--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-12/events.jsonl@@ -0,0 +1,8 @@+{"at_ms": 0, "attrs": {"approval_mode": "interactive", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 10, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 7010, "attrs": {"finish_reason": "stop", "ttft_ms": 1900, "usage": {"cache_read": 22600, "cache_write": 2400, "input_fresh": 6200, "output": 610, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 7010, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 7020, "last_message_id": "m2", "mono_ms": 7020, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"after_turn": true, "at_ms": 7100, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "title", "stream": false, "tools_hash": null, "tools_offered": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 7100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": true, "at_ms": 7600, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 300, "output": 12, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": null, "mono_ms": 7600, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 7100, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-12/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-12/expected-numbers.jsonnew file mode 100644index 00000000..661a7941--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-12/expected-numbers.json@@ -0,0 +1,31 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 7000,+ "other": 20,+ "other_shown": false,+ "summary": 0,+ "tools": 0,+ "total": 7020,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 31810,+ "anthropic:claude-sonnet-5 (title)": 312+ },+ "by_purpose": {+ "main": 31810,+ "title": 312+ },+ "cache_share": 0.717,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 32122,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-12/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-12/expected-recording.jsonnew file mode 100644index 00000000..02b7379e--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-12/expected-recording.json@@ -0,0 +1,141 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": 1900,+ "usage": {+ "cache_read": 22600,+ "cache_write": 2400,+ "input_fresh": 6200,+ "output": 610,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 7000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": true,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "title",+ "stream": false,+ "tools_hash": null,+ "tools_offered": 0,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 300,+ "output": 12,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 500,+ "kind": "model",+ "message_id": null,+ "name": "model",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 7100,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "interactive",+ "attended": true,+ "duration_ms": 7020,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m2",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-13/events.jsonl b/tests/corpora/observability/golden-phase1/S1-13/events.jsonlnew file mode 100644index 00000000..84a1cec2--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-13/events.jsonl@@ -0,0 +1,10 @@+{"at_ms": 0, "attrs": {"approval_mode": "bypass-approvals", "attended": true, "reviewer": {"active": false, "kind": null, "model": null, "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {"sandbox": {"enforcement": "full", "profile": "allowlist", "provider": "openshell", "sites": 3}}, "trigger": "user", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 2000, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {}, "call_id": "c1", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 1000, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"decision": {"origin": "bypass", "path": [{"detail": "bypass", "outcome": "allowed", "stage": "permission"}]}, "exit_code": 2, "result_bytes": 627, "risk_class": "exec", "sandbox": {"blocked_count": null, "blocked_known": true, "notice": null}}, "call_id": "c1", "call_index": 0, "content": {"blocked": [{"count": null, "first_at": null, "host": "semgrep.dev", "late": null, "port": 443, "uncertain": true}, {"count": null, "first_at": null, "host": "metrics.semgrep.dev", "late": null, "port": 443, "uncertain": true}]}, "kind": "tool", "message_id": "m3", "mono_ms": 4100, "name": "run_shell", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 1000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 4100, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 4100, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 2500, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 5000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 4100, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 5000, "last_message_id": "m4", "mono_ms": 5000, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-13/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-13/expected-numbers.jsonnew file mode 100644index 00000000..8f4040cb--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-13/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 1900,+ "other": 0,+ "other_shown": false,+ "summary": 0,+ "tools": 3100,+ "total": 5000,+ "waiting": 0+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 4700+ },+ "by_purpose": {+ "main": 4700+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 4700,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-13/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-13/expected-recording.jsonnew file mode 100644index 00000000..579e93e2--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-13/expected-recording.json@@ -0,0 +1,205 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 2000,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "bypass",+ "path": [+ {+ "detail": "bypass",+ "outcome": "allowed",+ "stage": "permission"+ }+ ]+ },+ "exit_code": 2,+ "result_bytes": 627,+ "risk_class": "exec",+ "sandbox": {+ "blocked_count": null,+ "blocked_known": true,+ "notice": null+ }+ },+ "call_id": "c1",+ "call_index": 0,+ "content": {+ "blocked": [+ {+ "count": null,+ "first_at": null,+ "host": "semgrep.dev",+ "late": null,+ "port": 443,+ "uncertain": true+ },+ {+ "count": null,+ "first_at": null,+ "host": "metrics.semgrep.dev",+ "late": null,+ "port": 443,+ "uncertain": true+ }+ ]+ },+ "duration_ms": 3100,+ "kind": "tool",+ "message_id": "m3",+ "name": "run_shell",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 1000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 2500,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 900,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 4100,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "bypass-approvals",+ "attended": true,+ "duration_ms": 5000,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": null,+ "model": null,+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {+ "sandbox": {+ "enforcement": "full",+ "profile": "allowlist",+ "provider": "openshell",+ "sites": 3+ }+ },+ "started_at": 0,+ "status": "completed",+ "trigger": "user",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/S1-16/events.jsonl b/tests/corpora/observability/golden-phase1/S1-16/events.jsonlnew file mode 100644index 00000000..9386e868--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-16/events.jsonl@@ -0,0 +1,13 @@+{"at_ms": 0, "attrs": {"approval_mode": "auto-approve", "attended": false, "reviewer": {"active": false, "kind": "session_model", "model": "anthropic:claude-sonnet-5", "shadow": false}}, "first_message_id": "m1", "kind": "run", "mono_ms": 0, "session_id": "sess_A", "stamp": {}, "trigger": "schedule", "turn_id": "sess_A:turn_1", "type": "turn_started", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"block_hash": null, "per_turn": {"folders": 0, "mode_note": null, "sandbox_note": false, "skills_hash": null, "skills_menu": 0}, "session_prompt_hash": null, "session_start": {"agents_md": 0, "memories": [], "memory_mode": "full", "rules": 0}, "size_chars": 0}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "mono_ms": 0, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 5, "attrs": {}, "call_id": null, "call_index": null, "content": {}, "kind": "context", "message_id": null, "mono_ms": 5, "name": "context", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_1", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 0, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 0, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 1000, "attrs": {"finish_reason": "tool_calls", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1500, "output": 100, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m2", "mono_ms": 1000, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 0, "status": "ok", "step_id": "step_2", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 5000, "attrs": {"attended": false, "for_call_id": "c", "kind": "approval", "where": "inbox"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "mono_ms": 5000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 10805000, "attrs": {"outcome": "approved"}, "call_id": "c", "call_index": 0, "content": {}, "kind": "wait", "message_id": null, "mono_ms": 10805000, "name": "approval", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 5000, "status": "ok", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10805000, "attrs": {}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "mono_ms": 10805000, "name": "email_send", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 10805500, "attrs": {"decision": {"origin": "user", "path": [{"outcome": "needs_user", "stage": "permission"}, {"outcome": "suspended_in_auto_approve", "stage": "grant"}, {"outcome": "skipped_unattended", "stage": "auto_approver"}, {"outcome": "parked_inbox", "stage": "card"}, {"outcome": "approved_once", "stage": "resolved"}]}, "result_bytes": 12, "risk_class": "external", "sandbox": null}, "call_id": "c", "call_index": 0, "content": {}, "kind": "tool", "message_id": "m3", "mono_ms": 10805500, "name": "email_send", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10805000, "status": "ok", "step_id": "step_4", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"after_turn": false, "at_ms": 10805500, "attrs": {"context_window": 1000000, "model": "anthropic:claude-sonnet-5", "provider": "anthropic", "provider_title": "Anthropic", "purpose": "main", "stream": true, "tools_hash": "f671e3", "tools_offered": 6}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "mono_ms": 10805500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_started", "v": 1}+{"after_turn": false, "at_ms": 10806500, "attrs": {"finish_reason": "stop", "ttft_ms": null, "usage": {"cache_read": 0, "cache_write": 0, "input_fresh": 1700, "output": 80, "reasoning": null, "reported": true}}, "call_id": null, "call_index": null, "content": {}, "kind": "model", "message_id": "m4", "mono_ms": 10806500, "name": "model", "parent_step_id": null, "session_id": "sess_A", "shadow": false, "started_at": 10805500, "status": "ok", "step_id": "step_5", "turn_id": "sess_A:turn_1", "type": "step_ended", "v": 1}+{"at_ms": 10806500, "last_message_id": "m4", "mono_ms": 10806500, "session_id": "sess_A", "status": "completed", "turn_id": "sess_A:turn_1", "type": "turn_ended", "v": 1}+{"at_ms": 10806500, "content": {"resolved_by": "devika"}, "mono_ms": 10806500, "session_id": "sess_A", "step_id": "step_3", "turn_id": "sess_A:turn_1", "type": "step_updated", "v": 1}diff --git a/tests/corpora/observability/golden-phase1/S1-16/expected-numbers.json b/tests/corpora/observability/golden-phase1/S1-16/expected-numbers.jsonnew file mode 100644index 00000000..56bffb20--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-16/expected-numbers.json@@ -0,0 +1,29 @@+{+ "buckets_by_turn": {+ "sess_A:turn_1": {+ "auto_approver": 0,+ "model": 2000,+ "other": 4000,+ "other_shown": false,+ "summary": 0,+ "tools": 500,+ "total": 10806500,+ "waiting": 10800000+ }+ },+ "usage": {+ "at_least": false,+ "auto_approver_checks_not_reported": 0,+ "by_model": {+ "anthropic:claude-sonnet-5": 3380+ },+ "by_purpose": {+ "main": 3380+ },+ "cache_share": 0.0,+ "failed_calls": 0,+ "overflow_calls": 0,+ "pill": 3380,+ "unreported_calls": 0+ }+}diff --git a/tests/corpora/observability/golden-phase1/S1-16/expected-recording.json b/tests/corpora/observability/golden-phase1/S1-16/expected-recording.jsonnew file mode 100644index 00000000..db94c71b--- /dev/null+++ b/tests/corpora/observability/golden-phase1/S1-16/expected-recording.json@@ -0,0 +1,216 @@+{+ "steps": [+ {+ "after_turn": false,+ "attrs": {+ "block_hash": null,+ "per_turn": {+ "folders": 0,+ "mode_note": null,+ "sandbox_note": false,+ "skills_hash": null,+ "skills_menu": 0+ },+ "session_prompt_hash": null,+ "session_start": {+ "agents_md": 0,+ "memories": [],+ "memory_mode": "full",+ "rules": 0+ },+ "size_chars": 0+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 5,+ "kind": "context",+ "message_id": null,+ "name": "context",+ "parent_step_id": null,+ "seq": 1,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s1",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "tool_calls",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1500,+ "output": 100,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m2",+ "name": "model",+ "parent_step_id": null,+ "seq": 2,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 0,+ "status": "ok",+ "step_id": "s2",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "attended": false,+ "for_call_id": "c",+ "kind": "approval",+ "outcome": "approved",+ "where": "inbox"+ },+ "call_id": "c",+ "call_index": 0,+ "content": {+ "resolved_by": "devika"+ },+ "duration_ms": 10800000,+ "kind": "wait",+ "message_id": null,+ "name": "approval",+ "parent_step_id": null,+ "seq": 3,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 5000,+ "status": "ok",+ "step_id": "s3",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "decision": {+ "origin": "user",+ "path": [+ {+ "outcome": "needs_user",+ "stage": "permission"+ },+ {+ "outcome": "suspended_in_auto_approve",+ "stage": "grant"+ },+ {+ "outcome": "skipped_unattended",+ "stage": "auto_approver"+ },+ {+ "outcome": "parked_inbox",+ "stage": "card"+ },+ {+ "outcome": "approved_once",+ "stage": "resolved"+ }+ ]+ },+ "result_bytes": 12,+ "risk_class": "external",+ "sandbox": null+ },+ "call_id": "c",+ "call_index": 0,+ "content": {},+ "duration_ms": 500,+ "kind": "tool",+ "message_id": "m3",+ "name": "email_send",+ "parent_step_id": null,+ "seq": 4,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10805000,+ "status": "ok",+ "step_id": "s4",+ "turn_id": "sess_A:turn_1"+ },+ {+ "after_turn": false,+ "attrs": {+ "context_window": 1000000,+ "finish_reason": "stop",+ "model": "anthropic:claude-sonnet-5",+ "provider": "anthropic",+ "provider_title": "Anthropic",+ "purpose": "main",+ "stream": true,+ "tools_hash": "f671e3",+ "tools_offered": 6,+ "ttft_ms": null,+ "usage": {+ "cache_read": 0,+ "cache_write": 0,+ "input_fresh": 1700,+ "output": 80,+ "reasoning": null,+ "reported": true+ }+ },+ "call_id": null,+ "call_index": null,+ "content": {},+ "duration_ms": 1000,+ "kind": "model",+ "message_id": "m4",+ "name": "model",+ "parent_step_id": null,+ "seq": 5,+ "session_id": "sess_A",+ "shadow": false,+ "started_at": 10805500,+ "status": "ok",+ "step_id": "s5",+ "turn_id": "sess_A:turn_1"+ }+ ],+ "turns": [+ {+ "approval_mode": "auto-approve",+ "attended": false,+ "duration_ms": 10806500,+ "first_message_id": "m1",+ "incomplete": false,+ "kind": "run",+ "last_message_id": "m4",+ "reviewer": {+ "active": false,+ "kind": "session_model",+ "model": "anthropic:claude-sonnet-5",+ "shadow": false+ },+ "schema_version": 1,+ "seq": 1,+ "session_id": "sess_A",+ "stamp": {},+ "started_at": 0,+ "status": "completed",+ "trigger": "schedule",+ "turn_id": "sess_A:turn_1"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/index.json b/tests/corpora/observability/golden-phase1/index.jsonnew file mode 100644index 00000000..fa803f15--- /dev/null+++ b/tests/corpora/observability/golden-phase1/index.json@@ -0,0 +1,341 @@+{+ "frozen_with_format": "1.0",+ "frozen": "2026-10-31",+ "shape": "recording format 1.0 (recording-format.md): events and expected recordings validate against recording-format.schema.json",+ "made_by": "phase-1/lab/make_golden.py",+ "checked_by": "phase-1/lab/check_golden.py",+ "scenarios": [+ {+ "id": "S1-01",+ "title": "One model call, no tools (Anthropic)",+ "events": 6,+ "turns": 1,+ "steps": 2,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-02",+ "title": "Tools one after another (OpenAI Chat)",+ "events": 14,+ "turns": 1,+ "steps": 6,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-03",+ "title": "Two tools at the same time",+ "events": 12,+ "turns": 1,+ "steps": 5,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-04",+ "title": "Ask for approval, approved after a wait",+ "events": 13,+ "turns": 1,+ "steps": 5,+ "known_gaps": {},+ "simulated": {+ "resolved_by c1": "who answered comes from an audit row the lab stamps the way the manager does"+ },+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-05",+ "title": "Auto-approve: allow, block, unsure",+ "events": 33,+ "turns": 1,+ "steps": 15,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-06",+ "title": "Auto-approve with a decision-model reviewer",+ "events": 14,+ "turns": 1,+ "steps": 6,+ "known_gaps": {},+ "simulated": {+ "*": "decision-model reviewers are not on main (PR #759); the verdict is scripted"+ },+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-07",+ "title": "Shadow evaluation: one mismatch, one match",+ "events": 30,+ "turns": 1,+ "steps": 12,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-08",+ "title": "Auto-approver could not run (no key)",+ "events": 17,+ "turns": 1,+ "steps": 7,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-09",+ "title": "Provider fails, then Retry",+ "events": 12,+ "turns": 2,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-10",+ "title": "A summary in the middle of a turn",+ "events": 15,+ "turns": 1,+ "steps": 6,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-11",+ "title": "Two explore helpers at the same time",+ "events": 24,+ "turns": 1,+ "steps": 11,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": false+ },+ {+ "id": "S1-12",+ "title": "Session title after the first turn",+ "events": 8,+ "turns": 1,+ "steps": 3,+ "known_gaps": {},+ "simulated": {+ "*": "the title call is made by the lab the way manager.py does it, through a title-tagged view"+ },+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-13",+ "title": "Sandboxed command blocked from a website",+ "events": 10,+ "turns": 1,+ "steps": 4,+ "known_gaps": {+ "blocked sites with counts (content)": "V-04"+ },+ "simulated": {+ "turn stamp: sandbox": "the stamp is passed in the way the engine would read describe()",+ "*": "no real sandbox: the real network_note code runs on a stand-in workspace"+ },+ "events_identical_on_second_run": true+ },+ {+ "id": "S1-16",+ "title": "Unattended run parked in the Inbox",+ "events": 13,+ "turns": 1,+ "steps": 5,+ "known_gaps": {},+ "simulated": {+ "trigger": "the trigger is passed by whoever starts the turn (the manager); the lab passes it"+ },+ "events_identical_on_second_run": true+ },+ {+ "id": "M-01a",+ "title": "Stop pressed while a tool runs",+ "events": 8,+ "turns": 1,+ "steps": 3,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-01b",+ "title": "Stop pressed while the model is writing",+ "events": 5,+ "turns": 1,+ "steps": 2,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-02",+ "title": "A call that does not report usage",+ "events": 14,+ "turns": 1,+ "steps": 6,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-03",+ "title": "Resume after a restart with an approval pending",+ "events": 11,+ "turns": 1,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-04",+ "title": "Grants: allow for the session, then no card",+ "events": 21,+ "turns": 1,+ "steps": 9,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-05",+ "title": "Five reviewer denials: the breaker trips",+ "events": 55,+ "turns": 1,+ "steps": 26,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-06a",+ "title": "Summary after the provider says the conversation is too long",+ "events": 13,+ "turns": 1,+ "steps": 5,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-06c",+ "title": "Summary due but nothing old enough to summarise",+ "events": 10,+ "turns": 1,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-07",+ "title": "A made-up tool and arguments that did not parse",+ "events": 12,+ "turns": 1,+ "steps": 5,+ "known_gaps": {+ "bad-arguments step found only via the transcript (C-5)": "C-5 (until E1 adds the id)"+ },+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-08",+ "title": "Step limit reached",+ "events": 18,+ "turns": 1,+ "steps": 8,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-09",+ "title": "Two sessions through one router, plus a proxy call",+ "events": 16,+ "turns": 2,+ "steps": 6,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-10",+ "title": "The title call races the next turn",+ "events": 14,+ "turns": 2,+ "steps": 5,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-12",+ "title": "A non-streamed call, then a stream that dies",+ "events": 10,+ "turns": 1,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-13",+ "title": "Attendance 'auto' refuses a card by rule",+ "events": 10,+ "turns": 1,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-14",+ "title": "Plan mode refuses a write",+ "events": 10,+ "turns": 1,+ "steps": 4,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ },+ {+ "id": "M-17",+ "title": "A shadow check that fails is not shown as a failure",+ "events": 18,+ "turns": 1,+ "steps": 7,+ "known_gaps": {},+ "simulated": {},+ "events_identical_on_second_run": true+ }+ ],+ "not_in_golden": [+ {+ "id": "S1-14",+ "title": "Machine and provider stamp",+ "why": "standalone: runs no turn through the recorder; covered by recording-format.md"+ },+ {+ "id": "S1-15",+ "title": "Coworker fingerprint across a skill edit",+ "why": "standalone: runs no turn through the recorder; covered by recording-format.md"+ },+ {+ "id": "M-11",+ "title": "Token mapping test vectors for every provider family",+ "why": "standalone: runs no turn through the recorder; covered by recording-format.md"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/vectors/piece-store.json b/tests/corpora/observability/golden-phase1/vectors/piece-store.jsonnew file mode 100644index 00000000..a01162a3--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/piece-store.json@@ -0,0 +1,74 @@+{+ "note": "Constructed, not captured: a small request in the shape of an Anthropic call, stored the lab's way.",+ "request_bytes_sent": "{\"model\":\"claude-haiku-4-5\",\"max_tokens\":1024,\"stream\":true,\"system\":[{\"type\":\"text\",\"text\":\"You are a careful assistant.\"}],\"messages\":[{\"role\":\"user\",\"content\":\"Read notes.txt\"},{\"role\":\"assistant\",\"content\":\"The release is planned for Friday.\"}],\"tools\":[{\"name\":\"read_file\",\"description\":\"Read a file\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"path\":{\"type\":\"string\"}}}}]}",+ "exchange": {+ "request": {+ "method": "POST",+ "url": "https://api.anthropic.com/v1/messages",+ "headers": {+ "content-type": "application/json",+ "anthropic-version": "2026-10-21"+ },+ "body_sha256": "f9014d83c2850243ceb7017f53a679a0d084cc84929d09e27c725a8bc5749bf4",+ "body_size": 381,+ "manifest": {+ "model": "claude-haiku-4-5",+ "max_tokens": 1024,+ "stream": true,+ "system": [+ {+ "$blob": "c67700dbcac3b29cb58c155e49720133f5f4a636469008332113e758330d5c3d"+ }+ ],+ "messages": [+ {+ "$blob": "4439b689d920477ac0ebc6f376a03908bd2018c530ea783c50f1fde742057fbf"+ },+ {+ "$blob": "e6dc06e3631cd0d7e766f1e7dfdf6e3994c0523fccc2916bfe492124adebb649"+ }+ ],+ "tools": [+ {+ "$blob": "2d00c896f13b34b11a557ee8c7ba9ea8a18f83f6c452371016a8747eb9050c6b"+ }+ ]+ }+ },+ "response": {+ "status": 200,+ "headers": {+ "content-type": "application/json"+ },+ "body_blob": "d218fc4edbaf8db89d746267eced538f68c28dd7c4f237f8fe2ef209b548c645",+ "body_size": 80+ }+ },+ "pieces": [+ {+ "sha256": "c67700dbcac3b29cb58c155e49720133f5f4a636469008332113e758330d5c3d",+ "size": 53,+ "data": "{\"text\":\"You are a careful assistant.\",\"type\":\"text\"}"+ },+ {+ "sha256": "4439b689d920477ac0ebc6f376a03908bd2018c530ea783c50f1fde742057fbf",+ "size": 42,+ "data": "{\"content\":\"Read notes.txt\",\"role\":\"user\"}"+ },+ {+ "sha256": "e6dc06e3631cd0d7e766f1e7dfdf6e3994c0523fccc2916bfe492124adebb649",+ "size": 67,+ "data": "{\"content\":\"The release is planned for Friday.\",\"role\":\"assistant\"}"+ },+ {+ "sha256": "2d00c896f13b34b11a557ee8c7ba9ea8a18f83f6c452371016a8747eb9050c6b",+ "size": 121,+ "data": "{\"description\":\"Read a file\",\"input_schema\":{\"properties\":{\"path\":{\"type\":\"string\"}},\"type\":\"object\"},\"name\":\"read_file\"}"+ },+ {+ "sha256": "d218fc4edbaf8db89d746267eced538f68c28dd7c4f237f8fe2ef209b548c645",+ "size": 80,+ "data": "{\"id\":\"msg_example\",\"type\":\"message\",\"content\":[{\"type\":\"text\",\"text\":\"Done.\"}]}"+ }+ ]+}diff --git a/tests/corpora/observability/golden-phase1/vectors/raw-exchange-anthropic.json b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-anthropic.jsonnew file mode 100644index 00000000..239233e4--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-anthropic.json@@ -0,0 +1,270 @@+{+ "wire": "anthropic",+ "source": "live: runs/live/anthropic_claude-haiku-4-5-20261031-103239, step s3",+ "note": "Response body is the complete captured body; its SHA-256 equals the step's body_blob.",+ "request": {+ "method": "POST",+ "url": "https://api.anthropic.com/v1/messages",+ "headers": {+ "accept": "application/json",+ "accept-encoding": "gzip, deflate",+ "anthropic-version": "2026-10-21",+ "connection": "keep-alive",+ "content-length": "25167",+ "content-type": "application/json",+ "host": "api.anthropic.com",+ "user-agent": "Anthropic/Python 2.3.0",+ "x-stainless-arch": "other:amd64",+ "x-stainless-async": "false",+ "x-stainless-lang": "python",+ "x-stainless-os": "Windows",+ "x-stainless-package-version": "2.3.0",+ "x-stainless-read-timeout": "600",+ "x-stainless-retry-count": "0",+ "x-stainless-runtime": "CPython",+ "x-stainless-runtime-version": "3.12.10",+ "x-stainless-timeout": "NOT_GIVEN"+ },+ "body_sha256": "553c988f4b80013b8425cd72f28f2747427760b8255c57eed121baa4487cd190",+ "body_size": 25167,+ "params": {+ "max_tokens": 32000,+ "model": "claude-haiku-4-5",+ "stream": true,+ "thinking": {+ "budget_tokens": 8192,+ "type": "enabled"+ },+ "tools_offered": 6+ },+ "manifest_keys": [+ "max_tokens",+ "messages",+ "model",+ "stream",+ "system",+ "thinking",+ "tools"+ ]+ },+ "response": {+ "status": 200,+ "headers": {+ "anthropic-organization-id": "<redacted>",+ "anthropic-ratelimit-input-tokens-limit": "10000000",+ "anthropic-ratelimit-input-tokens-remaining": "9996000",+ "anthropic-ratelimit-input-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-output-tokens-limit": "2000000",+ "anthropic-ratelimit-output-tokens-remaining": "2000000",+ "anthropic-ratelimit-output-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-requests-limit": "10000",+ "anthropic-ratelimit-requests-remaining": "9999",+ "anthropic-ratelimit-requests-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-tokens-limit": "12000000",+ "anthropic-ratelimit-tokens-remaining": "11996000",+ "anthropic-ratelimit-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-workspace-id": "<redacted>",+ "cache-control": "no-cache",+ "cf-cache-status": "DYNAMIC",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-encoding": "gzip",+ "content-security-policy": "default-src 'none'; frame-ancestors 'none'",+ "content-type": "text/event-stream; charset=utf-8",+ "date": "Sat, 31 Oct 2026 05:02:35 GMT",+ "request-id": "req_011CgZjDsmQMtPUPrERk1Ztk",+ "server": "cloudflare",+ "server-timing": "x-originResponse;dur=87",+ "strict-transport-security": "max-age=31536000; includeSubDomains; preload",+ "traceresponse": "00-4bc5786fd8dabddec624a1bbf09f6e71-1732dfc717bb0510-01",+ "transfer-encoding": "chunked",+ "vary": "Accept-Encoding",+ "x-robots-tag": "none"+ },+ "body_is_excerpt": false,+ "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"model\":\"claude-haiku-4-5-20251001\",\"id\":\"msg_011CgZjDswZHzgW7FBbDQoty\",\"type\":\"message\",\"role\":\"assistant\",\"content\":[],\"container\":null,\"stop_reason\":null,\"stop_sequence\":null,\"stop_details\":null,\"usage\":{\"input_tokens\":5,\"cache_creation_input_tokens\":130,\"cache_read_input_tokens\":5194,\"cache_creation\":{\"ephemeral_5m_input_tokens\":130,\"ephemeral_1h_input_tokens\":0},\"output_tokens\":4,\"service_tier\":\"standard\",\"inference_geo\":\"not_available\",\"speed\":\"standard\"},\"diagnostics\":null} }\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"} }\n\nevent: ping\ndata: {\"type\": \"ping\"}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"The file notes.\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"txt appears\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\" to be empty\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\" or contains no readable\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\" content based\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\" on the response\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\" received\"} }\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\".\"} }\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0 }\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"stop_details\":null,\"container\":null},\"usage\":{\"input_tokens\":5,\"cache_creation_input_tokens\":130,\"cache_read_input_tokens\":5194,\"output_tokens\":23,\"output_tokens_details\":{\"thinking_tokens\":0}} }\n\nevent: message_stop\ndata: {\"type\":\"message_stop\" }\n\n",+ "body_blob": "e249f7ab12ef03aa8893b4eb8d82c19f8c8661f14a03c85ac9b6a6bbe2d84d0b"+ },+ "expected": {+ "provider_meta": {+ "wire": "anthropic",+ "status": 200,+ "request": {+ "max_tokens": 32000,+ "model": "claude-haiku-4-5",+ "stream": true,+ "thinking": {+ "budget_tokens": 8192,+ "type": "enabled"+ },+ "tools_offered": 6+ },+ "headers": {+ "anthropic-organization-id": "<redacted>",+ "anthropic-ratelimit-input-tokens-limit": "10000000",+ "anthropic-ratelimit-input-tokens-remaining": "9996000",+ "anthropic-ratelimit-input-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-output-tokens-limit": "2000000",+ "anthropic-ratelimit-output-tokens-remaining": "2000000",+ "anthropic-ratelimit-output-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-requests-limit": "10000",+ "anthropic-ratelimit-requests-remaining": "9999",+ "anthropic-ratelimit-requests-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-tokens-limit": "12000000",+ "anthropic-ratelimit-tokens-remaining": "11996000",+ "anthropic-ratelimit-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-workspace-id": "<redacted>",+ "cache-control": "no-cache",+ "cf-cache-status": "DYNAMIC",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-encoding": "gzip",+ "content-security-policy": "default-src 'none'; frame-ancestors 'none'",+ "content-type": "text/event-stream; charset=utf-8",+ "date": "Sat, 31 Oct 2026 05:02:35 GMT",+ "request-id": "req_011CgZjDsmQMtPUPrERk1Ztk",+ "server": "cloudflare",+ "server-timing": "x-originResponse;dur=87",+ "strict-transport-security": "max-age=31536000; includeSubDomains; preload",+ "traceresponse": "00-4bc5786fd8dabddec624a1bbf09f6e71-1732dfc717bb0510-01",+ "transfer-encoding": "chunked",+ "vary": "Accept-Encoding",+ "x-robots-tag": "none"+ },+ "event_counts": {+ "message_start": 1,+ "content_block_start": 1,+ "ping": 1,+ "content_block_delta": 8,+ "content_block_stop": 1,+ "message_delta": 1,+ "message_stop": 1+ },+ "events": {+ "message_start": {+ "type": "message_start",+ "message": {+ "model": "claude-haiku-4-5-20251001",+ "id": "msg_011CgZjDswZHzgW7FBbDQoty",+ "type": "message",+ "role": "assistant",+ "container": null,+ "stop_reason": null,+ "stop_sequence": null,+ "stop_details": null,+ "usage": {+ "input_tokens": 5,+ "cache_creation_input_tokens": 130,+ "cache_read_input_tokens": 5194,+ "cache_creation": {+ "ephemeral_5m_input_tokens": 130,+ "ephemeral_1h_input_tokens": 0+ },+ "output_tokens": 4,+ "service_tier": "standard",+ "inference_geo": "not_available",+ "speed": "standard"+ },+ "diagnostics": null+ }+ },+ "content_block_start": {+ "type": "content_block_start",+ "index": 0,+ "content_block": {+ "type": "text"+ }+ },+ "ping": {+ "type": "ping"+ },+ "content_block_delta": {+ "type": "content_block_delta",+ "index": 0,+ "delta": {+ "type": "text_delta"+ }+ },+ "content_block_stop": {+ "type": "content_block_stop",+ "index": 0+ },+ "message_delta": {+ "type": "message_delta",+ "delta": {+ "stop_reason": "end_turn",+ "stop_sequence": null,+ "stop_details": null,+ "container": null+ },+ "usage": {+ "input_tokens": 5,+ "cache_creation_input_tokens": 130,+ "cache_read_input_tokens": 5194,+ "output_tokens": 23,+ "output_tokens_details": {+ "thinking_tokens": 0+ }+ }+ },+ "message_stop": {+ "type": "message_stop"+ }+ }+ },+ "provider_facts": {+ "served_model": "claude-haiku-4-5-20251001",+ "provider_request_id": "req_011CgZjDsmQMtPUPrERk1Ztk",+ "provider_response_id": "msg_011CgZjDswZHzgW7FBbDQoty",+ "served_by": null,+ "reasoning": 0,+ "cache_read": 5194,+ "cache_write": 130,+ "cache_write_by_ttl": {+ "ephemeral_5m_input_tokens": 130,+ "ephemeral_1h_input_tokens": 0+ },+ "provider_total": null,+ "requested": {+ "thinking": {+ "budget_tokens": 8192,+ "type": "enabled"+ },+ "effort": null,+ "max_tokens": 32000,+ "temperature": null,+ "service_tier": null+ },+ "applied": {+ "service_tier": "standard",+ "speed": "standard",+ "inference_geo": "not_available"+ },+ "stop": {+ "reason": "end_turn",+ "sequence": null,+ "details": null+ },+ "provider_timing": {+ "server_timing": "x-originResponse;dur=87"+ },+ "rate_limit": {+ "anthropic-ratelimit-input-tokens-limit": "10000000",+ "anthropic-ratelimit-input-tokens-remaining": "9996000",+ "anthropic-ratelimit-input-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-output-tokens-limit": "2000000",+ "anthropic-ratelimit-output-tokens-remaining": "2000000",+ "anthropic-ratelimit-output-tokens-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-requests-limit": "10000",+ "anthropic-ratelimit-requests-remaining": "9999",+ "anthropic-ratelimit-requests-reset": "2026-10-31T05:02:35Z",+ "anthropic-ratelimit-tokens-limit": "12000000",+ "anthropic-ratelimit-tokens-remaining": "11996000",+ "anthropic-ratelimit-tokens-reset": "2026-10-31T05:02:35Z"+ },+ "hosted_tools": null,+ "cost_reported": null+ }+ },+ "lab_provider_facts_differs": []+}diff --git a/tests/corpora/observability/golden-phase1/vectors/raw-exchange-ollama.json b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-ollama.jsonnew file mode 100644index 00000000..ad576d9a--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-ollama.json@@ -0,0 +1,130 @@+{+ "wire": "ollama",+ "source": "live: runs/live/ollama_qwen3_0.6b-20261031-172105, step s3",+ "note": "Response body is an excerpt of the captured one (see recording-format.md section 6.6); expected values are computed from this excerpt.",+ "request": {+ "method": "POST",+ "url": "http://localhost:11434/api/chat",+ "headers": {+ "content-length": "25030",+ "content-type": "application/json",+ "host": "localhost:11434"+ },+ "body_sha256": "27076b0c7b676eff6a1b056b505bef8fac111d8451f53ebec9c706d6634a55e9",+ "body_size": 25030,+ "params": {+ "model": "qwen3:0.6b",+ "options": {+ "num_ctx": 16384,+ "num_predict": 32000+ },+ "shift": false,+ "stream": true,+ "tools_offered": 6+ },+ "manifest_keys": [+ "messages",+ "model",+ "options",+ "shift",+ "stream",+ "tools"+ ]+ },+ "response": {+ "status": 200,+ "headers": {+ "content-type": "application/x-ndjson",+ "date": "Sat, 31 Oct 2026 11:50:21 GMT",+ "transfer-encoding": "chunked"+ },+ "body_is_excerpt": true,+ "body": "{\"model\":\"qwen3:0.6b\",\"created_at\":\"2026-10-31T11:50:21.6924318Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\",\"thinking\":\"Okay\"},\"done\":false}\n{\"model\":\"qwen3:0.6b\",\"created_at\":\"2026-10-31T11:50:36.6256182Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":19252494900,\"load_duration\":20054700,\"prompt_eval_count\":4804,\"prompt_eval_cached_count\":4641,\"prompt_eval_duration\":3904031000,\"eval_count\":102,\"eval_duration\":15233262000}\n",+ "body_blob": null+ },+ "expected": {+ "provider_meta": {+ "wire": "ollama",+ "status": 200,+ "request": {+ "model": "qwen3:0.6b",+ "options": {+ "num_ctx": 16384,+ "num_predict": 32000+ },+ "shift": false,+ "stream": true,+ "tools_offered": 6+ },+ "headers": {+ "content-type": "application/x-ndjson",+ "date": "Sat, 31 Oct 2026 11:50:21 GMT",+ "transfer-encoding": "chunked"+ },+ "event_counts": {+ "chunk": 1,+ "done": 1+ },+ "events": {+ "chunk": {+ "model": "qwen3:0.6b",+ "created_at": "2026-10-31T11:50:21.6924318Z",+ "message": {+ "role": "assistant"+ },+ "done": false+ },+ "done": {+ "model": "qwen3:0.6b",+ "created_at": "2026-10-31T11:50:36.6256182Z",+ "message": {+ "role": "assistant"+ },+ "done": true,+ "done_reason": "stop",+ "total_duration": 19252494900,+ "load_duration": 20054700,+ "prompt_eval_count": 4804,+ "prompt_eval_cached_count": 4641,+ "prompt_eval_duration": 3904031000,+ "eval_count": 102,+ "eval_duration": 15233262000+ }+ }+ },+ "provider_facts": {+ "served_model": "qwen3:0.6b",+ "provider_request_id": null,+ "provider_response_id": null,+ "served_by": null,+ "reasoning": null,+ "cache_read": 4641,+ "cache_write": null,+ "cache_write_by_ttl": null,+ "provider_total": null,+ "requested": {+ "num_ctx": 16384,+ "max_tokens": 32000,+ "temperature": null,+ "think": null,+ "shift": false,+ "keep_alive": null+ },+ "applied": {},+ "stop": {+ "reason": "stop"+ },+ "provider_timing": {+ "total_duration": 19252494900,+ "load_duration": 20054700,+ "prompt_eval_duration": 3904031000,+ "eval_duration": 15233262000,+ "created_at": "2026-10-31T11:50:36.6256182Z"+ },+ "rate_limit": null,+ "hosted_tools": null,+ "cost_reported": null+ }+ },+ "lab_provider_facts_differs": []+}diff --git a/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_chat.json b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_chat.jsonnew file mode 100644index 00000000..789e81d8--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_chat.json@@ -0,0 +1,203 @@+{+ "wire": "openai_chat",+ "source": "live: runs/live/openrouter_deepseek_deepseek-v4-pro-20261031-103410, step s2",+ "note": "Response body is an excerpt of the captured one (see recording-format.md section 6.6); expected values are computed from this excerpt.",+ "request": {+ "method": "POST",+ "url": "https://openrouter.ai/api/v1/chat/completions",+ "headers": {+ "accept": "application/json",+ "accept-encoding": "gzip, deflate",+ "connection": "keep-alive",+ "content-length": "24116",+ "content-type": "application/json",+ "host": "openrouter.ai",+ "user-agent": "OpenAI/Python 3.41.0",+ "x-stainless-arch": "other:amd64",+ "x-stainless-async": "false",+ "x-stainless-lang": "python",+ "x-stainless-os": "Windows",+ "x-stainless-package-version": "3.41.0",+ "x-stainless-read-timeout": "600",+ "x-stainless-retry-count": "0",+ "x-stainless-runtime": "CPython",+ "x-stainless-runtime-version": "3.12.10"+ },+ "body_sha256": "9498454d1cdb5b9c4d07d50c4734913e771dcabc9a89002cd98a6280395daa63",+ "body_size": 24116,+ "params": {+ "max_tokens": 32000,+ "model": "deepseek/deepseek-v4-pro",+ "stream": true,+ "stream_options": {+ "include_usage": true+ },+ "tools_offered": 6+ },+ "manifest_keys": [+ "max_tokens",+ "messages",+ "model",+ "stream",+ "stream_options",+ "tools"+ ]+ },+ "response": {+ "status": 200,+ "headers": {+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "X-Generation-Id,X-Provider-Name,request-id,cf-ray",+ "alt-svc": "h3=\":443\"; ma=86400",+ "cache-control": "no-cache",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-type": "text/event-stream",+ "date": "Sat, 31 Oct 2026 05:03:54 GMT",+ "permissions-policy": "payment=(self \"https://checkout.stripe.com\" \"https://connect-js.stripe.com\" \"https://js.stripe.com\" \"https://*.js.stripe.com\" \"https://hooks.stripe.com\")",+ "referrer-policy": "no-referrer, strict-origin-when-cross-origin",+ "server": "cloudflare",+ "transfer-encoding": "chunked",+ "x-content-type-options": "nosniff",+ "x-generation-id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83"+ },+ "body_is_excerpt": true,+ "body": "data: {\"id\":\"gen-1793423032-7A9TfPu0ihdcIwJRbw83\",\"object\":\"chat.completion.chunk\",\"created\":1793423032,\"model\":\"deepseek/deepseek-v4-pro\",\"provider\":\"Relace\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\",\"role\":\"assistant\",\"reasoning\":\"The\",\"reasoning_details\":[{\"type\":\"reasoning.text\",\"text\":\"The\",\"format\":\"unknown\",\"index\":0}]},\"finish_reason\":null,\"native_finish_reason\":null}]}\n\ndata: {\"id\":\"gen-1793423032-7A9TfPu0ihdcIwJRbw83\",\"object\":\"chat.completion.chunk\",\"created\":1793423032,\"model\":\"deepseek/deepseek-v4-pro\",\"provider\":\"Relace\",\"choices\":[{\"index\":0,\"delta\":{\"content\":null,\"role\":\"assistant\",\"tool_calls\":[{\"index\":0,\"id\":\"call_1bfb342996db4badbae05225\",\"type\":\"function\",\"function\":{\"name\":\"read_file\",\"arguments\":\"\"}}]},\"finish_reason\":null,\"native_finish_reason\":null}]}\n\ndata: {\"id\":\"gen-1793423032-7A9TfPu0ihdcIwJRbw83\",\"object\":\"chat.completion.chunk\",\"created\":1793423032,\"model\":\"deepseek/deepseek-v4-pro\",\"provider\":\"Relace\",\"service_tier\":null,\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\",\"role\":\"assistant\"},\"finish_reason\":\"tool_calls\",\"native_finish_reason\":\"tool_calls\"}],\"usage\":{\"prompt_tokens\":4862,\"completion_tokens\":66,\"total_tokens\":4928,\"cost\":0.0014796,\"is_byok\":false,\"prompt_tokens_details\":{\"cached_tokens\":4608,\"cache_write_tokens\":0,\"audio_tokens\":0,\"video_tokens\":0},\"cost_details\":{\"upstream_inference_cost\":0.0014796,\"upstream_inference_prompt_cost\":0.0013806,\"upstream_inference_completions_cost\":0.000099},\"completion_tokens_details\":{\"reasoning_tokens\":23,\"image_tokens\":0,\"audio_tokens\":0}}}\n\ndata: [DONE]\n\n",+ "body_blob": null+ },+ "expected": {+ "provider_meta": {+ "wire": "openai_chat",+ "status": 200,+ "request": {+ "max_tokens": 32000,+ "model": "deepseek/deepseek-v4-pro",+ "stream": true,+ "stream_options": {+ "include_usage": true+ },+ "tools_offered": 6+ },+ "headers": {+ "access-control-allow-origin": "*",+ "access-control-expose-headers": "X-Generation-Id,X-Provider-Name,request-id,cf-ray",+ "alt-svc": "h3=\":443\"; ma=86400",+ "cache-control": "no-cache",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-type": "text/event-stream",+ "date": "Sat, 31 Oct 2026 05:03:54 GMT",+ "permissions-policy": "payment=(self \"https://checkout.stripe.com\" \"https://connect-js.stripe.com\" \"https://js.stripe.com\" \"https://*.js.stripe.com\" \"https://hooks.stripe.com\")",+ "referrer-policy": "no-referrer, strict-origin-when-cross-origin",+ "server": "cloudflare",+ "transfer-encoding": "chunked",+ "x-content-type-options": "nosniff",+ "x-generation-id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83"+ },+ "event_counts": {+ "chunk": 2,+ "chunk with usage": 1+ },+ "events": {+ "chunk": {+ "id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83",+ "object": "chat.completion.chunk",+ "created": 1793423032,+ "model": "deepseek/deepseek-v4-pro",+ "provider": "Relace",+ "choices": [+ {+ "index": 0,+ "delta": {+ "role": "assistant"+ },+ "finish_reason": null,+ "native_finish_reason": null+ }+ ]+ },+ "chunk with usage": {+ "id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83",+ "object": "chat.completion.chunk",+ "created": 1793423032,+ "model": "deepseek/deepseek-v4-pro",+ "provider": "Relace",+ "service_tier": null,+ "choices": [+ {+ "index": 0,+ "delta": {+ "role": "assistant"+ },+ "finish_reason": "tool_calls",+ "native_finish_reason": "tool_calls"+ }+ ],+ "usage": {+ "prompt_tokens": 4862,+ "completion_tokens": 66,+ "total_tokens": 4928,+ "cost": 0.0014796,+ "is_byok": false,+ "prompt_tokens_details": {+ "cached_tokens": 4608,+ "cache_write_tokens": 0,+ "audio_tokens": 0,+ "video_tokens": 0+ },+ "cost_details": {+ "upstream_inference_cost": 0.0014796,+ "upstream_inference_prompt_cost": 0.0013806,+ "upstream_inference_completions_cost": 9.9e-05+ },+ "completion_tokens_details": {+ "reasoning_tokens": 23,+ "image_tokens": 0,+ "audio_tokens": 0+ }+ }+ }+ }+ },+ "provider_facts": {+ "served_model": "deepseek/deepseek-v4-pro",+ "provider_request_id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83",+ "provider_response_id": "gen-1793423032-7A9TfPu0ihdcIwJRbw83",+ "served_by": "Relace",+ "reasoning": 23,+ "cache_read": 4608,+ "cache_write": 0,+ "cache_write_by_ttl": null,+ "provider_total": 4928,+ "requested": {+ "effort": null,+ "max_tokens": 32000,+ "temperature": null,+ "service_tier": null+ },+ "applied": {+ "service_tier": null,+ "system_fingerprint": null+ },+ "stop": {+ "reason": "tool_calls",+ "native_reason": "tool_calls"+ },+ "provider_timing": {+ "processing_ms": null+ },+ "rate_limit": null,+ "hosted_tools": null,+ "cost_reported": {+ "amount": 0.0014796,+ "details": {+ "upstream_inference_cost": 0.0014796,+ "upstream_inference_prompt_cost": 0.0013806,+ "upstream_inference_completions_cost": 9.9e-05+ },+ "is_byok": false+ }+ }+ },+ "lab_provider_facts_differs": []+}diff --git a/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_responses.json b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_responses.jsonnew file mode 100644index 00000000..d3375e0d--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/raw-exchange-openai_responses.json@@ -0,0 +1,332 @@+{+ "wire": "openai_responses",+ "source": "live: runs/live/openai_gpt-5.4-mini-20261031-103305, step s2",+ "note": "Response body is an excerpt of the captured one (see recording-format.md section 6.6); expected values are computed from this excerpt.",+ "request": {+ "method": "POST",+ "url": "https://api.openai.com/v1/responses",+ "headers": {+ "accept": "application/json",+ "accept-encoding": "gzip, deflate",+ "connection": "keep-alive",+ "content-length": "24016",+ "content-type": "application/json",+ "host": "api.openai.com",+ "user-agent": "OpenAI/Python 3.41.0",+ "x-stainless-arch": "other:amd64",+ "x-stainless-async": "false",+ "x-stainless-lang": "python",+ "x-stainless-os": "Windows",+ "x-stainless-package-version": "3.41.0",+ "x-stainless-read-timeout": "600",+ "x-stainless-retry-count": "0",+ "x-stainless-runtime": "CPython",+ "x-stainless-runtime-version": "3.12.10"+ },+ "body_sha256": "fdf6754667ce7a961d5618291c2c4aa87c642b588c62b8b27fc9a41238688b16",+ "body_size": 24016,+ "params": {+ "include": [+ "reasoning.encrypted_content"+ ],+ "model": "gpt-5.4-mini",+ "reasoning": {+ "summary": "auto"+ },+ "store": false,+ "stream": true,+ "tools_offered": 6+ },+ "manifest_keys": [+ "include",+ "input",+ "instructions",+ "model",+ "reasoning",+ "store",+ "stream",+ "tools"+ ]+ },+ "response": {+ "status": 200,+ "headers": {+ "access-control-expose-headers": "X-Request-ID, Server-Timing-Total, CF-Ray, CF-Ray",+ "alt-svc": "h3=\":443\"; ma=86400",+ "cf-cache-status": "DYNAMIC",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-type": "text/event-stream; charset=utf-8",+ "date": "Sat, 31 Oct 2026 05:02:58 GMT",+ "openai-organization": "<redacted>",+ "openai-processing-ms": "533",+ "openai-project": "<redacted>",+ "openai-version": "2020-10-01",+ "server": "cloudflare",+ "strict-transport-security": "max-age=31536000; includeSubDomains; preload",+ "transfer-encoding": "chunked",+ "x-content-type-options": "nosniff",+ "x-ratelimit-limit-requests": "5000",+ "x-ratelimit-limit-tokens": "2000000",+ "x-ratelimit-remaining-requests": "4999",+ "x-ratelimit-remaining-tokens": "1995025",+ "x-ratelimit-reset-requests": "12ms",+ "x-ratelimit-reset-tokens": "149ms",+ "x-request-id": "req_d09c538188174a33898283efd7e9913d"+ },+ "body_is_excerpt": true,+ "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0b2612a77a29e7cd016ae57681d1f887d2ba8f11cc84904762\",\"object\":\"response\",\"created_at\":1793422977,\"status\":\"in_progress\",\"access_programs\":null,\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":\"You are a careful assistant working on a small Python project. (shortened)\",\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-5.4-mini-2026-03-17\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"24h\",\"reasoning\":{\"context\":\"current_turn\",\"effort\":\"none\",\"mode\":\"standard\",\"summary\":\"detailed\"},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"name\":\"read_file\",\"(shortened)\":true}],\"top_logprobs\":0,\"top_p\":0.98,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0b2612a77a29e7cd016ae57681d1f887d2ba8f11cc84904762\",\"object\":\"response\",\"created_at\":1793422977,\"status\":\"completed\",\"access_programs\":null,\"background\":false,\"completed_at\":1793422978,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":\"You are a careful assistant working on a small Python project. (shortened)\",\"max_output_tokens\":null,\"max_tool_calls\":null,\"model\":\"gpt-5.4-mini-2026-03-17\",\"moderation\":null,\"output\":[{\"type\":\"function_call\",\"name\":\"read_file\",\"arguments\":\"{\\\"q\\\":\\\"notes.txt\\\"}\",\"(shortened)\":true}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"24h\",\"reasoning\":{\"context\":\"current_turn\",\"effort\":\"none\",\"mode\":\"standard\",\"summary\":\"detailed\"},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":false,\"temperature\":1.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"name\":\"read_file\",\"(shortened)\":true}],\"top_logprobs\":0,\"top_p\":0.98,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":4520,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":4352},\"output_tokens\":19,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":4539},\"user\":null,\"metadata\":{}},\"sequence_number\":11}\n\n",+ "body_blob": null+ },+ "expected": {+ "provider_meta": {+ "wire": "openai_responses",+ "status": 200,+ "request": {+ "include": [+ "reasoning.encrypted_content"+ ],+ "model": "gpt-5.4-mini",+ "reasoning": {+ "summary": "auto"+ },+ "store": false,+ "stream": true,+ "tools_offered": 6+ },+ "headers": {+ "access-control-expose-headers": "X-Request-ID, Server-Timing-Total, CF-Ray, CF-Ray",+ "alt-svc": "h3=\":443\"; ma=86400",+ "cf-cache-status": "DYNAMIC",+ "cf-ray": "<redacted>",+ "connection": "keep-alive",+ "content-type": "text/event-stream; charset=utf-8",+ "date": "Sat, 31 Oct 2026 05:02:58 GMT",+ "openai-organization": "<redacted>",+ "openai-processing-ms": "533",+ "openai-project": "<redacted>",+ "openai-version": "2020-10-01",+ "server": "cloudflare",+ "strict-transport-security": "max-age=31536000; includeSubDomains; preload",+ "transfer-encoding": "chunked",+ "x-content-type-options": "nosniff",+ "x-ratelimit-limit-requests": "5000",+ "x-ratelimit-limit-tokens": "2000000",+ "x-ratelimit-remaining-requests": "4999",+ "x-ratelimit-remaining-tokens": "1995025",+ "x-ratelimit-reset-requests": "12ms",+ "x-ratelimit-reset-tokens": "149ms",+ "x-request-id": "req_d09c538188174a33898283efd7e9913d"+ },+ "event_counts": {+ "response.created": 1,+ "response.completed": 1+ },+ "events": {+ "response.created": {+ "type": "response.created",+ "response": {+ "id": "resp_0b2612a77a29e7cd016ae57681d1f887d2ba8f11cc84904762",+ "object": "response",+ "created_at": 1793422977,+ "status": "in_progress",+ "access_programs": null,+ "background": false,+ "completed_at": null,+ "error": null,+ "frequency_penalty": 0.0,+ "incomplete_details": null,+ "max_output_tokens": null,+ "max_tool_calls": null,+ "model": "gpt-5.4-mini-2026-03-17",+ "moderation": null,+ "parallel_tool_calls": true,+ "presence_penalty": 0.0,+ "previous_response_id": null,+ "prompt_cache_key": null,+ "prompt_cache_retention": "24h",+ "reasoning": {+ "context": "current_turn",+ "effort": "none",+ "mode": "standard",+ "summary": "detailed"+ },+ "safety_identifier": null,+ "service_tier": "auto",+ "store": false,+ "temperature": 1.0,+ "text": {+ "format": {+ "type": "text"+ },+ "verbosity": "medium"+ },+ "tool_choice": "auto",+ "tool_usage": {+ "image_gen": {+ "input_tokens": 0,+ "input_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "output_tokens": 0,+ "output_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "total_tokens": 0+ },+ "web_search": {+ "num_requests": 0+ }+ },+ "top_logprobs": 0,+ "top_p": 0.98,+ "truncation": "disabled",+ "usage": null,+ "user": null,+ "metadata": {}+ },+ "sequence_number": 0+ },+ "response.completed": {+ "type": "response.completed",+ "response": {+ "id": "resp_0b2612a77a29e7cd016ae57681d1f887d2ba8f11cc84904762",+ "object": "response",+ "created_at": 1793422977,+ "status": "completed",+ "access_programs": null,+ "background": false,+ "completed_at": 1793422978,+ "error": null,+ "frequency_penalty": 0.0,+ "incomplete_details": null,+ "max_output_tokens": null,+ "max_tool_calls": null,+ "model": "gpt-5.4-mini-2026-03-17",+ "moderation": null,+ "parallel_tool_calls": true,+ "presence_penalty": 0.0,+ "previous_response_id": null,+ "prompt_cache_key": null,+ "prompt_cache_retention": "24h",+ "reasoning": {+ "context": "current_turn",+ "effort": "none",+ "mode": "standard",+ "summary": "detailed"+ },+ "safety_identifier": null,+ "service_tier": "default",+ "store": false,+ "temperature": 1.0,+ "text": {+ "format": {+ "type": "text"+ },+ "verbosity": "medium"+ },+ "tool_choice": "auto",+ "tool_usage": {+ "image_gen": {+ "input_tokens": 0,+ "input_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "output_tokens": 0,+ "output_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "total_tokens": 0+ },+ "web_search": {+ "num_requests": 0+ }+ },+ "top_logprobs": 0,+ "top_p": 0.98,+ "truncation": "disabled",+ "usage": {+ "input_tokens": 4520,+ "input_tokens_details": {+ "cache_write_tokens": 0,+ "cached_tokens": 4352+ },+ "output_tokens": 19,+ "output_tokens_details": {+ "reasoning_tokens": 0+ },+ "total_tokens": 4539+ },+ "user": null,+ "metadata": {}+ },+ "sequence_number": 11+ }+ }+ },+ "provider_facts": {+ "served_model": "gpt-5.4-mini-2026-03-17",+ "provider_request_id": "req_d09c538188174a33898283efd7e9913d",+ "provider_response_id": "resp_0b2612a77a29e7cd016ae57681d1f887d2ba8f11cc84904762",+ "served_by": null,+ "reasoning": 0,+ "cache_read": 4352,+ "cache_write": 0,+ "cache_write_by_ttl": null,+ "provider_total": 4539,+ "requested": {+ "effort": null,+ "max_tokens": null,+ "temperature": null,+ "service_tier": null+ },+ "applied": {+ "effort": "none",+ "service_tier": "default",+ "prompt_cache_retention": "24h",+ "truncation": "disabled"+ },+ "stop": {+ "reason": "completed",+ "details": null+ },+ "provider_timing": {+ "processing_ms": "533",+ "created_at": 1793422977,+ "completed_at": 1793422978+ },+ "rate_limit": {+ "x-ratelimit-limit-requests": "5000",+ "x-ratelimit-limit-tokens": "2000000",+ "x-ratelimit-remaining-requests": "4999",+ "x-ratelimit-remaining-tokens": "1995025",+ "x-ratelimit-reset-requests": "12ms",+ "x-ratelimit-reset-tokens": "149ms"+ },+ "hosted_tools": {+ "image_gen": {+ "input_tokens": 0,+ "input_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "output_tokens": 0,+ "output_tokens_details": {+ "image_tokens": 0,+ "text_tokens": 0+ },+ "total_tokens": 0+ },+ "web_search": {+ "num_requests": 0+ }+ },+ "cost_reported": null+ }+ },+ "lab_provider_facts_differs": []+}diff --git a/tests/corpora/observability/golden-phase1/vectors/usage.json b/tests/corpora/observability/golden-phase1/vectors/usage.jsonnew file mode 100644index 00000000..741a531b--- /dev/null+++ b/tests/corpora/observability/golden-phase1/vectors/usage.json@@ -0,0 +1,397 @@+[+ {+ "id": "anthropic-m11",+ "family": "anthropic",+ "source": "scripted: lab/scenarios.py m11()",+ "raw": {+ "input_tokens": 6200,+ "output_tokens": 610,+ "cache_read_input_tokens": 22600,+ "cache_creation_input_tokens": 2400+ },+ "expected": {+ "input_fresh": 6200,+ "cache_read": 22600,+ "cache_write": 2400,+ "output": 610,+ "reasoning": null+ },+ "expected_total_input": 31200,+ "lab_family": "anthropic",+ "lab_gap": null+ },+ {+ "id": "anthropic-live",+ "family": "anthropic",+ "source": "live: runs/live/anthropic_claude-haiku-4-5-20261031-103239, step s3 (final message_delta usage)",+ "raw": {+ "cache_creation": {+ "ephemeral_1h_input_tokens": 0,+ "ephemeral_5m_input_tokens": 130+ },+ "cache_creation_input_tokens": 130,+ "cache_read_input_tokens": 5194,+ "inference_geo": "not_available",+ "input_tokens": 5,+ "output_tokens": 23,+ "service_tier": "standard",+ "speed": "standard",+ "output_tokens_details": {+ "thinking_tokens": 0+ }+ },+ "expected": {+ "input_fresh": 5,+ "cache_read": 5194,+ "cache_write": 130,+ "output": 23,+ "reasoning": 0+ },+ "expected_total_input": 5329,+ "lab_family": "anthropic",+ "lab_gap": "V-15: the app's mapping does not read output_tokens_details.thinking_tokens (until E3)"+ },+ {+ "id": "openai-chat-m11",+ "family": "openai_chat",+ "source": "scripted: lab/scenarios.py m11()",+ "raw": {+ "prompt_tokens": 10000,+ "completion_tokens": 300,+ "prompt_tokens_details": {+ "cached_tokens": 8000+ },+ "completion_tokens_details": {+ "reasoning_tokens": 120+ }+ },+ "expected": {+ "input_fresh": 2000,+ "cache_read": 8000,+ "cache_write": null,+ "output": 300,+ "reasoning": 120+ },+ "expected_total_input": 10000,+ "lab_family": "openai_chat",+ "lab_gap": null+ },+ {+ "id": "openai-chat-design-6.2",+ "family": "openai_chat",+ "source": "technical design §6.2, worked test vector",+ "raw": {+ "prompt_tokens": 28800,+ "completion_tokens": 610,+ "prompt_tokens_details": {+ "cached_tokens": 22600+ }+ },+ "expected": {+ "input_fresh": 6200,+ "cache_read": 22600,+ "cache_write": null,+ "output": 610,+ "reasoning": null+ },+ "expected_total_input": 28800,+ "lab_family": "openai_chat",+ "lab_gap": null+ },+ {+ "id": "openai-chat-probe-call-1",+ "family": "openai_chat",+ "source": "live: runs/live/cache-write-probe-20261031-171940/probe.json, call 1 (OpenRouter, Claude Haiku 4.5 served by Amazon Bedrock)",+ "raw": {+ "prompt_tokens": 4330,+ "completion_tokens": 5,+ "total_tokens": 4335,+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0,+ "cache_write_tokens": 4321,+ "video_tokens": 0+ },+ "completion_tokens_details": {+ "accepted_prediction_tokens": null,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": null,+ "image_tokens": 0+ }+ },+ "expected": {+ "input_fresh": 9,+ "cache_read": 0,+ "cache_write": 4321,+ "output": 5,+ "reasoning": 0+ },+ "expected_total_input": 4330,+ "lab_family": "openai_chat",+ "lab_gap": "V-21: the app does not read cache_write_tokens, so the written tokens are counted as fresh input (until E3)"+ },+ {+ "id": "openai-chat-probe-call-2",+ "family": "openai_chat",+ "source": "live: runs/live/cache-write-probe-20261031-171940/probe.json, call 2 (OpenRouter, Claude Haiku 4.5 served by Amazon Bedrock)",+ "raw": {+ "prompt_tokens": 4330,+ "completion_tokens": 4,+ "total_tokens": 4334,+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 4321,+ "cache_write_tokens": 0,+ "video_tokens": 0+ },+ "completion_tokens_details": {+ "accepted_prediction_tokens": null,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": null,+ "image_tokens": 0+ }+ },+ "expected": {+ "input_fresh": 9,+ "cache_read": 4321,+ "cache_write": 0,+ "output": 4,+ "reasoning": 0+ },+ "expected_total_input": 4330,+ "lab_family": "openai_chat",+ "lab_gap": "V-13: the app records cache_write as not reported although the provider sent 0 (until E3)"+ },+ {+ "id": "openai-chat-openrouter-live",+ "family": "openai_chat",+ "source": "live: runs/live/openrouter_deepseek_deepseek-v4-pro-20261031-103410, step s2",+ "raw": {+ "prompt_tokens": 4862,+ "completion_tokens": 66,+ "total_tokens": 4928,+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cache_write_tokens": 0,+ "cached_tokens": 4608,+ "video_tokens": 0+ },+ "completion_tokens_details": {+ "audio_tokens": 0,+ "image_tokens": 0,+ "reasoning_tokens": 23+ }+ },+ "expected": {+ "input_fresh": 254,+ "cache_read": 4608,+ "cache_write": 0,+ "output": 66,+ "reasoning": 23+ },+ "expected_total_input": 4862,+ "lab_family": "openai_chat",+ "lab_gap": "V-13: the app records cache_write as not reported although the provider sent 0 (until E3)"+ },+ {+ "id": "openai-responses-m11",+ "family": "openai_responses",+ "source": "scripted: lab/scenarios.py m11()",+ "raw": {+ "input_tokens": 5000,+ "input_tokens_details": {+ "cached_tokens": 3000+ },+ "output_tokens": 400,+ "output_tokens_details": {+ "reasoning_tokens": 150+ }+ },+ "expected": {+ "input_fresh": 2000,+ "cache_read": 3000,+ "cache_write": null,+ "output": 400,+ "reasoning": 150+ },+ "expected_total_input": 5000,+ "lab_family": "openai_responses",+ "lab_gap": null+ },+ {+ "id": "openai-responses-live",+ "family": "openai_responses",+ "source": "live: runs/live/openai_gpt-5.4-mini-20261031-103305, step s2",+ "raw": {+ "input_tokens": 4520,+ "input_tokens_details": {+ "cache_write_tokens": 0,+ "cached_tokens": 4352+ },+ "output_tokens": 19,+ "output_tokens_details": {+ "reasoning_tokens": 0+ },+ "total_tokens": 4539+ },+ "expected": {+ "input_fresh": 168,+ "cache_read": 4352,+ "cache_write": 0,+ "output": 19,+ "reasoning": 0+ },+ "expected_total_input": 4520,+ "lab_family": "openai_responses",+ "lab_gap": "V-13: the app records cache_write as not reported although the provider sent 0 (until E3)"+ },+ {+ "id": "openai-decisions-live",+ "family": "openai_decisions",+ "source": "live: runs/live/decision-reviewers-20261031-103449, first OpenAI Decisions check",+ "raw": {+ "input_tokens": 2822,+ "input_tokens_details": {+ "cached_tokens": 0,+ "cache_write_tokens": 0+ },+ "output_tokens": 0,+ "output_tokens_details": {+ "reasoning_tokens": 0+ },+ "total_tokens": 2822+ },+ "expected": {+ "input_fresh": 2822,+ "cache_read": 0,+ "cache_write": 0,+ "output": 0,+ "reasoning": 0+ },+ "expected_total_input": 2822,+ "lab_family": null,+ "lab_gap": "not mapped by the app's provider code: decision reviewers call their service directly (E23)"+ },+ {+ "id": "typesafe-jev-live",+ "family": "typesafe_jev",+ "source": "live: runs/live/decision-reviewers-20261031-103449, first TypeSafe Jev check",+ "raw": {+ "input_tokens": 6203,+ "output_tokens": 529+ },+ "expected": {+ "input_fresh": 6203,+ "cache_read": null,+ "cache_write": null,+ "output": 529,+ "reasoning": null+ },+ "expected_total_input": 6203,+ "lab_family": null,+ "lab_gap": "not mapped by the app's provider code: decision reviewers call their service directly (E23)"+ },+ {+ "id": "gemini-m11",+ "family": "gemini",+ "source": "scripted: lab/scenarios.py m11() (scripted only: no Gemini key yet, no live run)",+ "raw": {+ "prompt_token_count": 6000,+ "cached_content_token_count": 2000,+ "candidates_token_count": 300,+ "thoughts_token_count": 120+ },+ "expected": {+ "input_fresh": 4000,+ "cache_read": 2000,+ "cache_write": null,+ "output": 420,+ "reasoning": 120+ },+ "expected_total_input": 6000,+ "lab_family": "gemini",+ "lab_gap": null+ },+ {+ "id": "bedrock-converse-m11",+ "family": "bedrock_converse",+ "source": "scripted: lab/scenarios.py m11() (scripted only: no AWS credentials yet, no live run)",+ "raw": {+ "inputTokens": 1000,+ "outputTokens": 50,+ "cacheReadInputTokens": 4000,+ "cacheWriteInputTokens": 500+ },+ "expected": {+ "input_fresh": 1000,+ "cache_read": 4000,+ "cache_write": 500,+ "output": 50,+ "reasoning": null+ },+ "expected_total_input": 5500,+ "lab_family": "bedrock",+ "lab_gap": null+ },+ {+ "id": "ollama-m11",+ "family": "ollama",+ "source": "scripted: lab/scenarios.py m11()",+ "raw": {+ "prompt_eval_count": 900,+ "prompt_eval_cached_count": 700,+ "eval_count": 80+ },+ "expected": {+ "input_fresh": 200,+ "cache_read": 700,+ "cache_write": null,+ "output": 80,+ "reasoning": null+ },+ "expected_total_input": 900,+ "lab_family": "ollama",+ "lab_gap": "V-20: the app ignores prompt_eval_cached_count (until E3)"+ },+ {+ "id": "ollama-older-m11",+ "family": "ollama",+ "source": "scripted: lab/scenarios.py m11() (older Ollama: no cached count)",+ "raw": {+ "prompt_eval_count": 900,+ "eval_count": 80+ },+ "expected": {+ "input_fresh": 900,+ "cache_read": null,+ "cache_write": null,+ "output": 80,+ "reasoning": null+ },+ "expected_total_input": 900,+ "lab_family": "ollama",+ "lab_gap": "V-20: the app ignores prompt_eval_cached_count (until E3)"+ },+ {+ "id": "ollama-live",+ "family": "ollama",+ "source": "live: runs/live/ollama_qwen3_0.6b-20261031-172105, step s3 (last line, done: true)",+ "raw": {+ "prompt_eval_count": 4804,+ "prompt_eval_cached_count": 4641,+ "eval_count": 102+ },+ "expected": {+ "input_fresh": 163,+ "cache_read": 4641,+ "cache_write": null,+ "output": 102,+ "reasoning": null+ },+ "expected_total_input": 4804,+ "lab_family": "ollama",+ "lab_gap": "V-20: the app ignores prompt_eval_cached_count (until E3)"+ }+]diff --git a/tests/test_conversation_save_mid_change.py b/tests/test_conversation_save_mid_change.pyindex 385db9ef..0d98c091 100644--- a/tests/test_conversation_save_mid_change.py+++ b/tests/test_conversation_save_mid_change.py@@ -85,7 +85,9 @@ def test_restart_mid_approval_then_mode_switch_then_new_turn(tmp_path):rec.messages.append({"role": "notice", "kind": "mode_switch", "text": "Discuss is on."})store.save(rec)- TurnEngine._repair_dangling_tool_calls(SimpleNamespace(messages=rec.messages))+ engine = SimpleNamespace(messages=rec.messages)+ engine._add_message = lambda m, at=None: TurnEngine._add_message(engine, m, at=at)+ TurnEngine._repair_dangling_tool_calls(engine)rec.messages.append({"role": "user", "content": "never mind"})rec.messages.append({"role": "assistant", "content": "OK"})store.save(rec)diff --git a/tests/test_engine_stop.py b/tests/test_engine_stop.pyindex 7c52eb7b..5fcf0e74 100644--- a/tests/test_engine_stop.py+++ b/tests/test_engine_stop.py@@ -92,6 +92,7 @@ def test_stop_mid_stream_keeps_partial_text(tmp_path):"role": "notice","kind": "interrupted","ts": engine.messages[-1]["ts"],+ "mid": engine.messages[-1]["mid"],}partial = engine.messages[-2]assert partial["role"] == "assistant" and partial["content"].startswith("w0 ")diff --git a/tests/test_message_ids.py b/tests/test_message_ids.pynew file mode 100644index 00000000..1036b791--- /dev/null+++ b/tests/test_message_ids.py@@ -0,0 +1,119 @@+"""Observability E21: every message carries a stable `mid`.++A recorded step points at the transcript message it produced by its `mid`, a ULID stamped+when the message is appended or inserted. Positions move (a stub inserted mid-history after+a restart, a rewritten file); the `mid` does not. Like `ts`, it must never reach a provider.+"""++from __future__ import annotations++import asyncio++import aisuite as ai++from coworker.engine import TurnEngine+from coworker.permissions import PermissionEngine+from coworker.providers import AssistantTurn, ModelCapabilities, ProviderClient, ToolCall+from coworker.tools import ToolRegistry+++class CapturingProvider(ProviderClient):+ def __init__(self, turns):+ self._turns = list(turns)+ self.calls: list[list[dict]] = []++ def complete(self, *, model, messages, tools=None, **settings):+ self.calls.append([dict(m) for m in messages])+ return self._turns.pop(0)++ def capabilities(self, model):+ return ModelCapabilities()+++def _text(text):+ return AssistantTurn(text=text, finish_reason="stop")+++def _tool(name, args, call_id="call_1"):+ return AssistantTurn(+ tool_calls=[ToolCall(id=call_id, name=name, arguments=args)],+ finish_reason="tool_calls",+ )+++def _engine(tmp_path, turns, *, messages=None, instructions=None):+ provider = CapturingProvider(turns)+ registry = ToolRegistry()+ registry.register_all(ai.toolkits.files(root=str(tmp_path), allow_write=True))+ engine = TurnEngine(+ provider=provider,+ registry=registry,+ permissions=PermissionEngine(workspace_root=tmp_path),+ model="gpt-5.5",+ messages=messages,+ instructions=instructions,+ )+ return engine, provider+++def _run(engine, text):+ async def _go():+ return [ev async for ev in engine.run(text)]++ return asyncio.run(_go())+++def test_every_message_gets_a_unique_mid(tmp_path):+ (tmp_path / "a.txt").write_text("hello", encoding="utf-8")+ engine, _ = _engine(+ tmp_path,+ [_tool("read_file", {"path": "a.txt"}), _text("it says hello")],+ instructions="be brief",+ )+ _run(engine, "read a.txt")+ assert [m["role"] for m in engine.messages] == ["system", "user", "assistant", "tool", "assistant"]+ mids = [m["mid"] for m in engine.messages]+ assert all(isinstance(mid, str) and len(mid) == 26 for mid in mids)+ assert len(set(mids)) == len(mids)+ assert mids[1:] == sorted(mids[1:]) # sortable by creation+++def test_mid_never_reaches_a_provider(tmp_path):+ (tmp_path / "a.txt").write_text("hello", encoding="utf-8")+ engine, provider = _engine(tmp_path, [_tool("read_file", {"path": "a.txt"}), _text("done")])+ _run(engine, "read a.txt")+ assert provider.calls+ assert all("mid" not in m for call in provider.calls for m in call)+ assert all("mid" in m for m in engine.messages) # the strip is a copy+++def test_a_stub_inserted_mid_history_gets_its_own_mid_and_others_keep_theirs(tmp_path):+ # A restart left an assistant tool call with no result, followed by later messages.+ history = [+ {"role": "user", "content": "do it", "mid": "01OLDUSER000000000000000000"[:26]},+ {+ "role": "assistant",+ "content": "",+ "tool_calls": [{"id": "call_9", "type": "function",+ "function": {"name": "read_file", "arguments": "{}"}}],+ "mid": "01OLDASSIST0000000000000000"[:26],+ },+ {"role": "user", "content": "still there?", "mid": "01OLDUSER200000000000000000"[:26]},+ ]+ before = {m["mid"] for m in history}+ engine, _ = _engine(tmp_path, [_text("yes")], messages=history)+ _run(engine, "hello")+ stub = engine.messages[2]+ assert stub["role"] == "tool" and stub["tool_call_id"] == "call_9"+ assert stub["mid"] not in before+ assert {m["mid"] for m in engine.messages if m["mid"] in before} == before+++def test_messages_saved_before_mids_still_work(tmp_path):+ # A transcript written before E21: no mid anywhere. Nothing breaks, nothing is backfilled.+ history = [{"role": "user", "content": "hi"}, {"role": "assistant", "content": "hello"}]+ engine, provider = _engine(tmp_path, [_text("again")], messages=history)+ _run(engine, "once more")+ assert "mid" not in engine.messages[0] and "mid" not in engine.messages[1]+ assert "mid" in engine.messages[-1]+ assert all("mid" not in m for call in provider.calls for m in call)diff --git a/tests/test_observability_golden.py b/tests/test_observability_golden.pynew file mode 100644index 00000000..4a72dff9--- /dev/null+++ b/tests/test_observability_golden.py@@ -0,0 +1,84 @@+"""Observability golden test (Phase 1): recording events in, recording out.++The scenarios in `tests/corpora/observability/golden-phase1/` are the shared test of+recording format 1.0 (`ocw-context/docs/observability/golden/phase1/`, frozen 2026-10-31).+The Rust harness SDK runs the same files, so both engines fold the same events into the+same recording. Each scenario is replayed into a fresh recorder and compared with its+`expected-recording.json` exactly, after the one renaming the golden README describes:+step ids become `s1`, `s2`, ... by their position in the file.++The same replay through a `RecordingStore` must give back the same recording from+`recordings.db`, so nothing is lost or changed on the way to disk.+"""++from __future__ import annotations++import json+from pathlib import Path+from typing import Any++import pytest++from coworker.observability import Recorder, RecordingStore++GOLDEN = Path(__file__).parent / "corpora" / "observability" / "golden-phase1"+SCENARIOS = [s["id"] for s in json.loads((GOLDEN / "index.json").read_text("utf-8"))["scenarios"]]+++def _events(scenario: str) -> list[dict[str, Any]]:+ lines = (GOLDEN / scenario / "events.jsonl").read_text("utf-8").splitlines()+ return [json.loads(line) for line in lines if line.strip()]+++def _renamed(recording: dict[str, Any]) -> dict[str, Any]:+ """Step ids renamed s1, s2, ... in file order, with every field that holds one."""+ ids = {s["step_id"]: f"s{i}" for i, s in enumerate(recording["steps"], 1)}+ steps = []+ for s in recording["steps"]:+ s = json.loads(json.dumps(s))+ s["step_id"] = ids[s["step_id"]]+ s["parent_step_id"] = ids.get(s["parent_step_id"], s["parent_step_id"])+ if s["kind"] == "summary" and s["attrs"].get("model_step_id"):+ s["attrs"]["model_step_id"] = ids.get(+ s["attrs"]["model_step_id"], s["attrs"]["model_step_id"]+ )+ steps.append(s)+ return {"turns": recording["turns"], "steps": steps}+++def _replay(events: list[dict[str, Any]], store: RecordingStore | None = None) -> Recorder:+ rec = Recorder(store=store)+ for ev in events:+ rec.emit(ev)+ return rec+++def test_every_scenario_is_listed():+ folders = sorted(p.name for p in GOLDEN.iterdir() if (p / "events.jsonl").exists())+ assert sorted(SCENARIOS) == folders+ assert len(SCENARIOS) == 30++[email protected]("scenario", SCENARIOS)+def test_events_fold_to_the_expected_recording(scenario):+ expected = json.loads((GOLDEN / scenario / "expected-recording.json").read_text("utf-8"))+ got = _renamed(_replay(_events(scenario)).as_dict())+ assert got == expected++[email protected]("scenario", SCENARIOS)+def test_the_store_gives_back_the_same_recording(scenario, tmp_path):+ events = _events(scenario)+ in_memory = _replay(events).as_dict()+ store = RecordingStore(tmp_path / "recordings.db", background=False)+ try:+ _replay(events, store)+ sessions = {t["session_id"] for t in in_memory["turns"]}+ for session in sessions:+ want = {+ "turns": [t for t in in_memory["turns"] if t["session_id"] == session],+ "steps": [s for s in in_memory["steps"] if s["session_id"] == session],+ }+ assert store.load_recording(session) == want+ finally:+ store.close()diff --git a/tests/test_observability_store.py b/tests/test_observability_store.pynew file mode 100644index 00000000..9501c108--- /dev/null+++ b/tests/test_observability_store.py@@ -0,0 +1,264 @@+"""`recordings.db` (observability technical design §11): what the store writes, keeps and+deletes. The fold rules themselves are checked by test_observability_golden.py."""++from __future__ import annotations++import sqlite3+import threading+import time++import pytest++from coworker.observability import Recorder, RecordingStore, new_ulid+from coworker.observability import store as store_mod++DAY_MS = 24 * 60 * 60 * 1000+++def _turn(rec, turn_id, *, session="sess_A", at=0, mono=0):+ rec.emit({+ "type": "turn_started", "v": 1, "at_ms": at, "mono_ms": mono, "session_id": session,+ "turn_id": turn_id, "kind": "run", "trigger": "user", "first_message_id": "m1",+ "attrs": {"approval_mode": "interactive", "attended": True,+ "reviewer": {"active": False, "shadow": False, "kind": None, "model": None}},+ "stamp": {"machine": {"kind": "this_machine"}},+ })+++def _end_turn(rec, turn_id, *, session="sess_A", at=100, mono=100):+ rec.emit({"type": "turn_ended", "v": 1, "at_ms": at, "mono_ms": mono, "session_id": session,+ "turn_id": turn_id, "status": "completed", "last_message_id": "m2"})+++def _model_step(rec, step_id, turn_id, *, session="sess_A", at=10, mono=10, end=60, exchange=None,+ usage=None):+ base = {"v": 1, "session_id": session, "turn_id": turn_id, "step_id": step_id}+ rec.emit({**base, "type": "step_started", "at_ms": at, "mono_ms": mono, "kind": "model",+ "name": "model", "parent_step_id": None, "call_id": None, "call_index": None,+ "shadow": False, "after_turn": False,+ "attrs": {"purpose": "main", "model": "anthropic:claude-haiku-4-5",+ "context_window": 200000},+ "content": {}})+ attrs = {+ "usage": usage,+ "provider_facts": {"served_model": "claude-haiku-4-5-20251001",+ "provider_request_id": "req_1"},+ "provider_meta": [{"wire": "anthropic", "request": {"max_tokens": 1024}}],+ }+ rec.emit({**base, "type": "step_ended", "at_ms": end, "mono_ms": end, "status": "ok",+ "message_id": "m2", "kind": "model", "name": "model", "parent_step_id": None,+ "call_id": None, "call_index": None, "started_at": at, "attrs": attrs,+ "content": {"exchange": exchange} if exchange else {}})+++def store(tmp_path):+ s = RecordingStore(tmp_path / "recordings.db", background=False)+ yield s+ s.close()+++def test_store_lives_next_to_coworker_db(tmp_path):+ s = RecordingStore.beside(tmp_path, background=False)+ try:+ assert s.path == tmp_path / "recordings.db"+ assert s.path.exists()+ finally:+ s.close()+++def test_usage_and_provider_facts_are_columns(store):+ rec = Recorder(store=store)+ _turn(rec, "t1")+ _model_step(rec, "s1", "t1", usage={"input_fresh": 5, "cache_read": 5194, "cache_write": 130,+ "output": 23, "reasoning": None})+ _end_turn(rec, "t1")+ store.flush()+ row = store._conn.execute("SELECT * FROM steps WHERE step_id = 's1'").fetchone()+ assert (row["purpose"], row["model"], row["usage_reported"]) == (+ "main", "anthropic:claude-haiku-4-5", 1)+ assert (row["input_fresh"], row["cache_read"], row["cache_write"], row["output"],+ row["reasoning"]) == (5, 5194, 130, 23, None)+ assert (row["served_model"], row["provider_request_id"], row["context_window"]) == (+ "claude-haiku-4-5-20251001", "req_1", 200000)+ # provider_meta is kept out of the light attrs column and comes back on load+ assert "provider_meta" not in row["attrs"]+ step = store.load_recording("sess_A")["steps"][0]+ assert step["attrs"]["provider_meta"] == [{"wire": "anthropic", "request": {"max_tokens": 1024}}]+++def test_a_model_call_without_usage_is_marked_unreported(store):+ rec = Recorder(store=store)+ _turn(rec, "t1")+ _model_step(rec, "s1", "t1", usage=None)+ _end_turn(rec, "t1")+ store.flush()+ row = store._conn.execute("SELECT usage_reported, output FROM steps").fetchone()+ assert (row["usage_reported"], row["output"]) == (0, None)+++def test_a_step_written_many_times_is_one_row_with_its_last_state(store):+ rec = Recorder(store=store)+ _turn(rec, "t1")+ _model_step(rec, "s1", "t1")+ rec.emit({"type": "step_updated", "v": 1, "at_ms": 70, "mono_ms": 70, "session_id": "sess_A",+ "turn_id": "t1", "step_id": "s1", "attrs": {"where": "inbox"}})+ _end_turn(rec, "t1")+ store.flush()+ rows = store._conn.execute("SELECT seq, attrs FROM steps").fetchall()+ assert len(rows) == 1+ assert rows[0]["seq"] == 1 and '"where": "inbox"' in rows[0]["attrs"]+++def test_turn_seq_continues_after_a_restart(tmp_path):+ path = tmp_path / "recordings.db"+ s1 = RecordingStore(path, background=False)+ rec = Recorder(store=s1)+ _turn(rec, "t1")+ _end_turn(rec, "t1")+ s1.close()+ s2 = RecordingStore(path, background=False)+ try:+ rec2 = Recorder(store=s2) # a new server process: nothing in memory+ _turn(rec2, "t2", at=1000, mono=5)+ _end_turn(rec2, "t2", at=1100, mono=105)+ assert [t["seq"] for t in s2.load_recording("sess_A")["turns"]] == [1, 2]+ finally:+ s2.close()+++def test_pieces_are_stored_once_and_rebuilt_exactly(store):+ data = b'{"content":"Read notes.txt","role":"user"}'+ key = store.put_piece(data)+ assert store.put_piece(data) == key+ assert store.get_piece(key) == data+ assert store._conn.execute("SELECT COUNT(*) FROM exchange_pieces").fetchone()[0] == 1+ assert store._conn.execute("SELECT size FROM exchange_pieces").fetchone()[0] == len(data)+++def _exchange(store, *pieces: bytes):+ keys = [store.put_piece(p) for p in pieces]+ return [{"request": {"manifest": {"messages": [{"$blob": k} for k in keys[:-1]]}},+ "response": {"body_blob": keys[-1]}}], keys+++def test_deleting_a_session_deletes_its_recordings_and_unshared_pieces(store):+ rec = Recorder(store=store)+ shared = b'{"text":"system","type":"text"}'+ ex_a, keys_a = _exchange(store, shared, b"reply A")+ ex_b, keys_b = _exchange(store, shared, b"reply B")+ _turn(rec, "ta", session="sess_A")+ _model_step(rec, "sa", "ta", session="sess_A", exchange=ex_a)+ _end_turn(rec, "ta", session="sess_A")+ _turn(rec, "tb", session="sess_B")+ _model_step(rec, "sb", "tb", session="sess_B", exchange=ex_b)+ _end_turn(rec, "tb", session="sess_B")+ store.flush()++ rec.delete_session("sess_A")+ assert store.load_recording("sess_A") == {"turns": [], "steps": []}+ assert len(store.load_recording("sess_B")["steps"]) == 1+ assert store.get_piece(keys_a[1]) is None # only sess_A used it+ assert store.get_piece(keys_b[0]) == shared # still used by sess_B+ assert not [t for t in rec.turns.values() if t.session_id == "sess_A"]+++def test_a_deleted_session_is_not_written_back_by_pending_writes(store):+ rec = Recorder(store=store)+ _turn(rec, "ta")+ _model_step(rec, "sa", "ta") # pending, not flushed yet+ rec.delete_session("sess_A")+ store.flush()+ assert store._conn.execute("SELECT COUNT(*) FROM steps").fetchone()[0] == 0+ assert store._conn.execute("SELECT COUNT(*) FROM turns").fetchone()[0] == 0+++def test_retention_sweep_deletes_old_turns_in_batches(store, monkeypatch):+ monkeypatch.setattr(store_mod, "SWEEP_BATCH", 2)+ monkeypatch.setattr(store_mod, "SWEEP_PAUSE_S", 0)+ rec = Recorder(store=store)+ now = 100 * DAY_MS+ old_ex, old_keys = _exchange(store, b"old piece", b"old reply")+ for i in range(5): # five turns 31 days old+ at = now - 31 * DAY_MS + i+ _turn(rec, f"old{i}", at=at, mono=i * 1000)+ _model_step(rec, f"olds{i}", f"old{i}", at=at + 1, mono=i * 1000 + 1, end=i * 1000 + 2,+ exchange=old_ex)+ _end_turn(rec, f"old{i}", at=at + 3, mono=i * 1000 + 3)+ _turn(rec, "new", at=now - DAY_MS, mono=10_000)+ _model_step(rec, "news", "new", at=now - DAY_MS + 1, mono=10_001, end=10_002)+ _end_turn(rec, "new", at=now - DAY_MS + 3, mono=10_003)+ store.flush()++ assert store.sweep(now_ms=now) == 5+ left = store.load_recording("sess_A")+ assert [t["turn_id"] for t in left["turns"]] == ["new"]+ assert [s["step_id"] for s in left["steps"]] == ["news"]+ assert all(store.get_piece(k) is None for k in old_keys)+++def test_sweep_also_ages_out_steps_with_no_turn(store):+ rec = Recorder(store=store)+ # A proxy call: no session, no turn.+ rec.emit({"type": "step_ended", "v": 1, "at_ms": 5, "mono_ms": 5, "session_id": "",+ "turn_id": "", "step_id": "p1", "status": "ok", "kind": "model", "name": "model",+ "parent_step_id": None, "call_id": None, "started_at": 1, "attrs": {}})+ assert not rec.steps # written, and not kept in memory: no turn's end would release it+ store.flush()+ assert store._conn.execute("SELECT COUNT(*) FROM steps").fetchone()[0] == 1+ store.sweep(now_ms=40 * DAY_MS)+ assert store._conn.execute("SELECT COUNT(*) FROM steps").fetchone()[0] == 0+++def test_background_writer_writes_and_close_flushes(tmp_path):+ path = tmp_path / "recordings.db"+ s = RecordingStore(path) # its writer also runs the retention sweep: use today's times+ rec = Recorder(store=s)+ now = int(time.time() * 1000)+ _turn(rec, "t1", at=now)+ _model_step(rec, "s1", "t1", at=now + 10)+ _end_turn(rec, "t1", at=now + 100)+ s.close()+ conn = sqlite3.connect(path)+ try:+ assert conn.execute("SELECT COUNT(*) FROM steps").fetchone()[0] == 1+ assert conn.execute("SELECT status FROM turns").fetchone()[0] == "completed"+ finally:+ conn.close()+++def test_recorder_is_safe_from_many_threads(store):+ rec = Recorder(store=store)+ _turn(rec, "t1", mono=0)++ def tools(n):+ for i in range(50):+ sid = f"x{n}_{i}"+ base = {"v": 1, "session_id": "sess_A", "turn_id": "t1", "step_id": sid}+ rec.emit({**base, "type": "step_started", "at_ms": 1, "mono_ms": 1, "kind": "tool",+ "name": "read_file", "call_id": sid, "call_index": i})+ rec.emit({**base, "type": "step_ended", "at_ms": 2, "mono_ms": 2, "status": "ok",+ "kind": "tool", "name": "read_file", "call_id": sid, "started_at": 1})++ threads = [threading.Thread(target=tools, args=(n,)) for n in range(8)]+ for t in threads:+ t.start()+ for t in threads:+ t.join()+ _end_turn(rec, "t1", mono=10)+ steps = store.load_recording("sess_A")["steps"]+ assert len(steps) == 400+ assert sorted(s["seq"] for s in steps) == list(range(1, 401))+++def test_a_bad_event_never_raises(store):+ rec = Recorder(store=store)+ rec.emit({"type": "step_started"}) # no ids at all+ rec.emit({"type": "turn_ended", "turn_id": "unknown", "mono_ms": 0, "status": "completed"})+++def test_ulids_sort_by_creation_and_never_repeat():+ ids = [new_ulid() for _ in range(5000)]+ assert len(set(ids)) == 5000+ assert ids == sorted(ids)+ assert all(len(i) == 26 for i in ids)