Orchestrata Ultimate › Plans › research › audit-04-tracing-debugging

Audit 04 — Tracing / Debugging / Observability

Source: plans/research/audit-04-tracing-debugging.md at 8a2cb42ad · last changed 2026-07-27 · first committed 2026-07-04 · 56 lines.

Prose pending.

Plan text

Audit 04 — Tracing / Debugging / Observability

Headline: core/tracing/__init__.py::IterationTracer is a COMPLETE runtime per-volk tracer with ZERO production callers. Built, fully unwired. Biggest gap + cleanest insertion point.

@traces = static only

core/base/traces.py:28-71 + core/traceability/__init__.py:114-156 — attach __traces__ attr (spec/story/reqs) for the RTM. No timing/IO/runtime wrap. Consumers all AST static-analysis (collect_traces/generate_rtm/validate_traces).

Pipeline observability — two divergent systems

Logging — good, dormant

core/logging.py StructuredFormatter (JSON, contextvars correlation_id/session_id/volk_id, _EXTRA_FIELDS incl duration_ms/prompt_length/model/gate/cycle...). Gap C: configure_logging() has NO production caller — never installed. Gap D: new_correlation_id() only at gateway/server.py:503 (per WS connection), not per run/volk; contextvars never set around volk execution; thread_id not a log var.

Debug surfaces

Gaps + insertion (cleanest end-to-end)

  1. orchestrator/pipeline_runner.py:144 run — create IterationTracer(thread_id); set thread_id/tracer contextvar; new_correlation_id().
  2. _run_stage (218/280) — live pipeline.stage.start/complete + tracer.trace_event; capture traceback.format_exc() on failure (276 discards traceback — G4).
  3. agents/volks/base.py:152 _call_llm + :184 _call_llm_with_tools — tracer.trace_llm_call(...) + record tool calls; set volk_id contextvar.
  4. llm/client.py:559-570 / _capture_exchange:416 — feed elapsed_ms + structured usage + thread_id.
  5. Startup — call configure_logging(json_format=True).
  6. Reconcile the two PIPELINE_STREAM_KEYs (pipeline_kernel.py:42 vs kernel/pipeline_events.py:46).