-
Notifications
You must be signed in to change notification settings - Fork 2
obs(orchestration): planner/aggregator LLM calls not tracked in session metrics or /status #1899
Description
Description
When orchestration is active (orchestration.enabled = true), the LlmPlanner and LlmAggregator make LLM API calls that are invisible to the session metrics system.
Root cause
api_calls is incremented only in native.rs:375 and legacy.rs:363/426 — the main agent loop LLM call sites. LlmPlanner::plan() calls chat_typed() directly on the provider without going through those paths, so its API calls and token usage are never counted.
handle_status_command() at agent/mod.rs:3246 also reads only the 5 main metrics fields; it does not display m.orchestration.plans_total, m.orchestration.tasks_total, m.orchestration.tasks_completed, etc. from OrchestrationMetrics (already present in MetricsSnapshot).
Observed
/plan goal "Find all .rs files in crates/zeph-core/src" → 3-task plan created (LlmPlanner API call made)
/plan confirm → "Confirmed. Executing plan (3 tasks)..."
/status
API calls: 0 ← planner call not counted
Tokens: 369 / 0 ← 369 = restored conversation context; planner tokens missing
Expected
LlmPlanner/LlmAggregatorcalls incrementapi_calls,prompt_tokens,completion_tokensin the sharedMetricsCollector/statusshows anOrchestration:block whenorchestration.enabled = truewith plans/tasks counters fromOrchestrationMetrics
Fix sketch
Pass Arc<MetricsCollector> into LlmPlanner::new() and call collector.update(|m| { m.api_calls += 1; ... }) after each chat_typed() call. Similarly for LlmAggregator. Add orchestration stats block to handle_status_command() when m.orchestration.plans_total > 0.
Severity
LOW — observability gap. Cost tracking is also incomplete for orchestration sessions.
Found: session 104 (2026-03-16), v0.15.1.