mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
Spawn sessions recorded 0 tokens in production despite the full capture chain being deployed (hook in the image, settings registering it, /usage/sync, the finalize fetch). The chain is inherently racy: token counts live in the SDK server's in-memory state inside a short-lived agent container, and the orchestrator races to fetch /usage/status before the container is torn down — so for cold-respawned agents the fetch returns nothing (verified: parser and transcripts are correct, every spawn-session row was still 0). Read the durable source of truth instead. The host ~/.claude is already mounted into the orchestrator, so at finalize, when the SDK fetch yields nothing, sum the agent's newest Claude Code transcript directly (_usage_from_transcript + the existing _sum_transcript_usage). Removes the race entirely — usage is captured regardless of container timing.