Phase 1 of agent observability, engine items E7 and E21
(ocw-context docs/observability/phase-1/technical-design.md v1.0).
E7: coworker/observability/recorder.py is the one sink for the five
recording events. It folds them into turns and steps by recording
format 1.0 and keeps the canonical step order. coworker/observability/
store.py saves them in recordings.db next to coworker.db: pending
writes are merged by id and written by one background thread, so a
turn never waits and nothing is dropped. A daily sweep deletes
recordings older than 30 days in small batches, and deleting a session
deletes its recordings and the exchange pieces only it used.
E21: every message appended or inserted into the engine's history gets
a `mid` (a ULID) through one _add_message() helper. `mid` is a sidecar
like `ts`: stripped before any provider sees it. Older transcripts
without mids keep working.
The shared golden test (30 scenarios, copied into tests/corpora/
observability) passes 30 of 30, folded in memory and read back from
recordings.db.
Switch notices no longer consume the retry guard or hide the button.
Error, switch model, Retry is the intended recovery path; retry runs on the new model.
New reasoning_delta event; traces persist as a display sidecar stripped from provider feeds.
Sources: compat vendors' reasoning_content and Gemini thought summaries (include_thoughts).
Live-verified on GLM via Together and Gemini 3; Gemini tool loops stay healthy.
Engine appends a display-only notice message on error/interrupted; providers never see it.
New retry frame re-runs a failed turn with no new user message, guarded on the error tail.
GUI renders persisted notices on reload and a Retry button on the trailing error.
GUI flushes the streaming buffer into a durable item on interrupted/error.
Engine persists partial text on the provider-error path like the stop path.
e2e red-green verified; full suites pass.
Stream drops between chunks (+ the pre-first-token wait); pending approvals/questions/plans resolve as interrupted.
Running shell commands die via an executor interrupt hook; skipped tool calls still get results (no orphans).
Also fixes delete_session calling a nonexistent engine.interrupt().