Skip to content

feat(insights): every Board agent run counts — Coding, Reviewer, Testing, Discovery - #265

Merged
hoangsnowy merged 2 commits into
mainfrom
feat/insights-agent-runs
Oct 22, 2026
Merged

hoangsnowy merged 2 commits into
mainfrom
feat/insights-agent-runs

Conversation

@hoangsnowy

Copy link
Copy Markdown
Owner

Summary

Insights showed no numbers although Autopilot's agents worked all day: it reads pipeline_runs + run_metrics, and only the 5-agent pipeline wrote them.

  • LlmCallScope (Domain, AsyncLocal) + ObservedLlmClient (Llm): inside an open scope every call is recorded — tokens (fresh / cache read / cache write / output / reasoning), cost, latency, provider, outcome. The factory wraps clients only while a scope is open, so the pipeline and unscoped calls are untouched.
  • IPipelineRunRepository.SaveAgentRunAsync: one run per Board agent step with its calls (no artifacts → detail reads as not found).
  • Recorded: Coding, Reviewer and Testing steps of Board tasks, and New idea (Discovery). The Thorough engine keeps its own pipeline run (no double count). Calls on a member's computer are $0 with the ≈ API figure Insights already shows.

Test plan

  • AgentRunMetricsTests: scope nesting, success + failure recorded (failure rethrown), agent run counted by the cost summary (calls, runs, tokens, by agent) and listed in the history.
  • Full suite green locally.
  • Lab: after the next Autopilot task, Insights shows runs/calls/tokens by agent (Coding / Reviewer / Testing).

🤖 Generated with Claude Code

https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB

hoangsnowy and others added 2 commits October 22, 2026 23:13
…very

Insights showed nothing while Autopilot's agents worked all day: it reads pipeline runs + run_metrics, and only the
5-agent pipeline wrote them. Now every LLM call made inside an LlmCallScope is recorded (ObservedLlmClient, wrapped
by the factory only while a scope is open — tokens incl. cache read/write and reasoning, cost, latency, provider,
outcome), and each Board agent step is stored as a run with those calls (IPipelineRunRepository.SaveAgentRunAsync;
no pipeline artifacts, so its run detail reads as not found). Coding and Testing runs on the Board and New idea
(Discovery) record themselves; the Thorough engine keeps its own pipeline run. Calls made on a member's computer
cost $0 and show their ≈ API figure, as Insights already labels them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
@hoangsnowy
hoangsnowy merged commit 8e6f551 into main Oct 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant