Skip to content

fix: suppress default context usage updates#797

Open
jsgrrchg wants to merge 1 commit into
agentclientprotocol:mainfrom
jsgrrchg:fix/suppress-default-context-usage-update
Open

fix: suppress default context usage updates#797
jsgrrchg wants to merge 1 commit into
agentclientprotocol:mainfrom
jsgrrchg:fix/suppress-default-context-usage-update

Conversation

@jsgrrchg

@jsgrrchg jsgrrchg commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Suppress live usage_update notifications while the session context window is still the generic 200000 fallback placeholder.

Details

This keeps accumulating streamed usage internally, but avoids publishing a misleading live size value until the context window is known from either a model-name heuristic or authoritative result.modelUsage.

Final result usage updates are unchanged, so clients still receive the correct usage, cost, and context window once modelUsage.contextWindow is available.

Fixes #596

Testing

  • npm test -- --run src/tests/acp-agent.test.ts -t "usage_update computation"
  • npm run build
  • npm run test:run
  • npx prettier --check src/acp-agent.ts src/tests/acp-agent.test.ts src/tests/session-config-options.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

usage_update.size reports 200000 for default modelId even though it resolves to the 1M Opus variant

1 participant