Bug Report: gh aw does not correctly count sub-agent model usage
Summary
gh aw appears to attribute all token usage to the orchestrator model and does not break out usage for sub-agents invoked with explicit model overrides.
In my workflow Test Sub-Agent Models, three sub-agents were invoked with claude-haiku-4.5, but the audit output and token summary only report claude-sonnet-4.6.
Environment
- gh-aw CLI version:
v0.77.5
Reproduction
- Use a workflow with engine
copilot and inline sub-agents configured with:
- Dispatch three sub-agents (
agent-alpha, agent-beta, agent-gamma) with explicit model override claude-haiku-4.5.
- Run the workflow.
- Inspect audit output and artifacts:
run_summary.json -> token_usage_summary.by_model
sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl
agent-stdio.log
Expected Behavior
- Either:
- token/model accounting includes separate entries for sub-agent model usage (
claude-haiku-4.5), or
- audit clearly indicates that sub-agent model overrides were ignored/fell back and why.
by_model should not imply only one model was used when sub-agents were dispatched with explicit different model overrides.
Actual Behavior
- Audit output reports only orchestrator model usage:
by_model contains only claude-sonnet-4.6
token-usage.jsonl entries all show model:"claude-sonnet-4.6"
- At the same time, sub-agent dispatch logs show requests with explicit override
claude-haiku-4.5.
This creates a counting/attribution gap for sub-agent usage and makes model-level cost/perf analysis unreliable.
Evidence
1) Sub-agent dispatch indicates haiku override
From agent-stdio.log:
● Agent-alpha(claude-haiku-4.5) Get model name
● Agent-beta(claude-haiku-4.5) Get model name
● Agent-gamma(claude-haiku-4.5) Get model name
2) Audit by_model only has sonnet
From run_summary.json:
"token_usage_summary": {
"by_model": {
"claude-sonnet-4.6": {
"provider": "copilot",
"requests": 15
}
}
}
3) Raw token usage also only has sonnet
From sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl:
{"event":"token_usage","provider":"copilot","model":"claude-sonnet-4.6", ...}
Impact
- Incorrect or incomplete model attribution in audit results.
- Misleading cost optimization decisions when sub-agents are intended to use cheaper models.
- Difficult to validate whether sub-agent model overrides are actually honored.
Requested Fix
- Include sub-agent model attribution in token accounting and
by_model aggregation.
- If fallback/override is ignored, emit explicit machine-readable reason per sub-agent invocation.
- Add an audit section like:
subagent_model_requests (requested/effective)
subagent_model_actuals (observed from token logs)
mismatch_count and reason codes.
Notes
- It may indicate an underlying runtime override problem, but even then the audit output should surface that mismatch explicitly.
- Potential regression signal: this behavior appears inconsistent with recent
gh-aw guidance that sub-agent model: pins are honored in v0.77.4+.
test-subagent-models.md
Bug Report: gh aw does not correctly count sub-agent model usage
Summary
gh awappears to attribute all token usage to the orchestrator model and does not break out usage for sub-agents invoked with explicit model overrides.In my workflow
Test Sub-Agent Models, three sub-agents were invoked withclaude-haiku-4.5, but the audit output and token summary only reportclaude-sonnet-4.6.Environment
v0.77.5Reproduction
copilotand inline sub-agents configured with:model: claude-haiku-4.5agent-alpha,agent-beta,agent-gamma) with explicit model overrideclaude-haiku-4.5.run_summary.json->token_usage_summary.by_modelsandbox/firewall/logs/api-proxy-logs/token-usage.jsonlagent-stdio.logExpected Behavior
claude-haiku-4.5), orby_modelshould not imply only one model was used when sub-agents were dispatched with explicit different model overrides.Actual Behavior
by_modelcontains onlyclaude-sonnet-4.6token-usage.jsonlentries all showmodel:"claude-sonnet-4.6"claude-haiku-4.5.This creates a counting/attribution gap for sub-agent usage and makes model-level cost/perf analysis unreliable.
Evidence
1) Sub-agent dispatch indicates haiku override
From
agent-stdio.log:2) Audit by_model only has sonnet
From
run_summary.json:3) Raw token usage also only has sonnet
From
sandbox/firewall/logs/api-proxy-logs/token-usage.jsonl:{"event":"token_usage","provider":"copilot","model":"claude-sonnet-4.6", ...}Impact
Requested Fix
by_modelaggregation.subagent_model_requests(requested/effective)subagent_model_actuals(observed from token logs)mismatch_countand reason codes.Notes
gh-awguidance that sub-agentmodel:pins are honored in v0.77.4+.test-subagent-models.md