Skip to content

obs(orchestration): planner/aggregator LLM calls not tracked in session metrics or /status #1899

@bug-ops

Description

@bug-ops

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 / LlmAggregator calls increment api_calls, prompt_tokens, completion_tokens in the shared MetricsCollector
  • /status shows an Orchestration: block when orchestration.enabled = true with plans/tasks counters from OrchestrationMetrics

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestllmzeph-llm crate (Ollama, Claude)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions