fix(observability): persist full ResearchResult and per-item trace events #56
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/trace-full-result"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #54.
Two complementary fixes for the trace observability gap blocking Phase 3:
(a) Persist full ResearchResult.
TraceLogger.write_result()dumps the pydantic model to<trace_id>.result.jsonnext to the JSONL trace. The agent calls it right before thecompletestep.cli replaynow loads the sibling and renders the structured tables (answer, citations, gaps, discovery_events, open_questions, confidence_factors, cost) under the step log.(b) Per-item trace events. The agent emits one
gap_recorded/citation_recorded/discovery_recordedtrace event per item from the final result. The JSONL stream gains a queryable timeline of what was kept, with categories and topics in-band — no need to load the sibling for category-level analysis.Tests
TraceLogger.result_path,write_resultfrom pydantic + dict, agent persists result + emits per-item events, replay renders persisted result, replay reports absence cleanly.ask "What is the half-life of caffeine?" --depth shallow): both files written, replay renders the result.