feat(status): add API call count to session status and usage footer#913
Open
BingqingLyu wants to merge 3 commits intomainfrom
Open
feat(status): add API call count to session status and usage footer#913BingqingLyu wants to merge 3 commits intomainfrom
BingqingLyu wants to merge 3 commits intomainfrom
Conversation
added 3 commits
March 17, 2026 15:36
- track API call count per run in embedded runner - persist per-run call count on session entries - show current-turn call count in /status output - show current-turn call count in response usage footer - keep calls semantics aligned with current-turn token usage - add/update unit tests for API call count display
Bot review feedback: callCount was missing in followup-runner.ts persistRunSessionUsage call, causing stale count after followup turns. This aligns with how usage/lastCallUsage are already handled there.
- Add callCount tracking in subscribeEmbeddedPiSession (incremented on each recordAssistantUsage call, i.e., each LLM API response with usage data) - Add attemptCallCount to EmbeddedRunAttemptResult - Pass callCount from attempt to run.ts and accumulate properly - Add tests for callCount accumulation scenarios This fixes the issue where callCount only counted attempts, not individual API calls within tool-call loops.
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
callCounttracking in the embedded runner, persisted to session entry, displayed in both/statusand response usage footerChange Type
Scope
Linked Issue/PR
User-visible / Behavior Changes
/statusoutput now includes📞 Calls: Nin the usage line (current turn only)📞 Calls: NwhenresponseUsageis enabled (current turn only)Security Impact
Repro + Verification
Environment
Steps
/statuscommand in any session with prior activity📞 Calls: NresponseUsage: fullin configExpected
🧮 Tokens: 154k in / 656 out · 💵 Cost: $0.40 · 📞 Calls: 3
Actual
Works as expected.
Evidence
src/auto-reply/status.test.ts- "shows API call count from the latest run"src/auto-reply/reply/agent-runner-utils.test.ts- "formats response usage line with API call count"Human Verification
Review Conversations
Compatibility / Migration
Failure Recovery
Risks and Mitigations
None. This is a display-only feature with no side effects.