Track agent calls across providers#340
Open
ozymandiashh wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #336 by making agent/subagent activity visible at the provider-call level for the providers we can cover safely in one PR: Gemini, Claude, and Codex.
The issue reports two related gaps:
This PR keeps the scope focused on parser/discovery accuracy. It does not add a new provider and does not rely on real local/private usage data.
Why
Before this change, Gemini sessions were collapsed into one aggregate
ParsedProviderCallper session. That meant a long Gemini session with multiple assistant messages, tool calls, bash commands, and timestamps looked like one call in CodeBurn. The total usage could be present, but the shape was not useful for understanding what happened inside the session.For Claude, CodeBurn already handled the nested subagent layout, but not the direct project-level
subagents/*.jsonlshape reported by users. Those files could be on disk and still never enter the parser.For Codex, the provider already maps agent tool calls such as
spawn_agent,wait_agent, andclose_agentto the canonicalAgenttool. This PR adds regression coverage so that behavior remains protected while we fix the broader agent-tracking issue.What changed
Gemini
seenKeysset.This makes Gemini tool/call reporting more granular. Per-tool counts can increase compared with the old aggregate behavior because repeated tools are now attributed to the specific Gemini message that used them instead of being deduped across the whole session.
Gemini Cache Migration
Existing session-cache entries can contain the old aggregate key shape:
When CodeBurn sees that legacy shape for an unchanged Gemini session file, it reparses that file and rewrites the cache with the new granular keys:
That avoids leaving existing users stuck with the old one-call-per-session view until the source file changes.
Claude
subagents/*.jsonldiscovery.Setduring discovery so overlapping discovery paths cannot double-count the same file.Codex
spawn_agent,wait_agent, andclose_agentnormalize toAgent.Validation
npx vitest run tests/providers/gemini.test.ts tests/providers/codex.test.ts tests/parser-large-session.test.ts tests/parser-gemini-cache.test.ts tests/provider-registry.test.ts- 37/37 tests passed.npm run build- passed.git diff --check- passed.check,assess,semgrep).Notes
I did not validate against a real Fedora reporter environment or real local subagent history. The coverage here uses synthetic fixtures and existing parser behavior, so no local project names, prompts, paths, session IDs, usage values, or private product details are included.