Summary
Post-v0.3.1, lead agent execution records are written with input_tokens=0, output_tokens=0 despite the run completing successfully. Worker/researcher agents write correct non-zero token counts. Model and provider fields are correctly populated (100%) — this is a token flush timing issue specific to lead agents.
Evidence
Data squad obs scan (2026-05-11) — 19 post-v0.3.1 records (completed_at ≥ 2026-04-24):
| Metric |
Count |
% |
| model healthy |
19/19 |
100% ✅ |
| provider healthy |
19/19 |
100% ✅ |
| tokens > 0 |
7/19 |
36.8% ❌ |
Affected records: 12 lead agent executions from 2026-05-05, 2026-05-07, 2026-05-08 (eng-lead, finance-lead, customer-lead, intel-lead, company-lead, product-lead, cli-lead, operations-lead, marketing-lead).
Healthy records (7): all researcher/intel worker agents — tokens populated correctly.
Full scan: agents-squads/data/reports/daily/obs-quality-2026-05-11.md
Root Cause Hypothesis
Lead agents write the execution record before token counts are finalized — likely writing a "start" record with model/provider resolved but tokens not yet accumulated. No subsequent update is written to finalize the token count.
Worker agents may write their records at a different point in the execution lifecycle (after completion), which is why they capture tokens correctly.
Impact
Goal #2 (obs data quality) blocked: obs_data_healthy metric at 36.8% (target: 100%). Cost attribution for lead agent runs is inaccurate — all lead execution costs appear as $0.
Fix Required
Investigate squads-cli token flush timing for lead agent execution records in the completed event write path. Ensure token counts are written after final model call completes, not at record initialization.
Relates To
Summary
Post-v0.3.1, lead agent execution records are written with
input_tokens=0, output_tokens=0despite the run completing successfully. Worker/researcher agents write correct non-zero token counts. Model and provider fields are correctly populated (100%) — this is a token flush timing issue specific to lead agents.Evidence
Data squad obs scan (2026-05-11) — 19 post-v0.3.1 records (completed_at ≥ 2026-04-24):
Affected records: 12 lead agent executions from 2026-05-05, 2026-05-07, 2026-05-08 (eng-lead, finance-lead, customer-lead, intel-lead, company-lead, product-lead, cli-lead, operations-lead, marketing-lead).
Healthy records (7): all researcher/intel worker agents — tokens populated correctly.
Full scan:
agents-squads/data/reports/daily/obs-quality-2026-05-11.mdRoot Cause Hypothesis
Lead agents write the execution record before token counts are finalized — likely writing a "start" record with model/provider resolved but tokens not yet accumulated. No subsequent update is written to finalize the token count.
Worker agents may write their records at a different point in the execution lifecycle (after completion), which is why they capture tokens correctly.
Impact
Goal #2 (obs data quality) blocked:
obs_data_healthymetric at 36.8% (target: 100%). Cost attribution for lead agent runs is inaccurate — all lead execution costs appear as $0.Fix Required
Investigate squads-cli token flush timing for lead agent execution records in the
completedevent write path. Ensure token counts are written after final model call completes, not at record initialization.Relates To