-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix: Roo Anthropic input token normalization (avoid double-count) #9224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
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
…d double-counting cached tokens; revert core-level heuristic to keep Task provider-agnostic
Contributor
Review complete. No issues found. The implementation correctly normalizes input token reporting based on API protocol:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
mrubens
approved these changes
Nov 13, 2025
mini2s
added a commit
to zgsm-ai/costrict
that referenced
this pull request
Nov 13, 2025
* Add Intercom as a subprocessor (RooCodeInc#8718) * web: Leftover white bg (RooCodeInc#8719) Leftover white bg * feat(zgsm): add supportsMaxTokens flag and adjust max token handling * docs: update Configuring Profiles video link (RooCodeInc#8189) Co-authored-by: Roo Code <[email protected]> * Fix link text for Roomote Control in README (RooCodeInc#8742) * Try a 5s status mutation timeout (RooCodeInc#8734) * web: Landing page for the reviewerFirst pass (RooCodeInc#8740) * First pass * SEO * Update apps/web-roo-code/src/app/reviewer/page.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Remove GPT‑5 instructions/reasoning_summary from UI message metadata to prevent ui_messages.json bloat (RooCodeInc#8756) chore(gpt5): stop persisting instructions/reasoning_summary in UI message metadata Problem: ui_messages.json was getting bloated with unused or duplicated content (system 'instructions' and 'reasoning_summary') that we do not read back. Root cause: earlier OpenAI Responses API implementation persisted these fields to per-message metadata; however, 'instructions' are already sent as top-level request instructions and 'reasoning_summary' is surfaced live via streaming events. Neither field is consumed from storage. Changes: (1) Task.persistGpt5Metadata now stores only previous_response_id; (2) removed instructions and reasoning_summary from types; (3) updated Zod schema; (4) persistence layer writes messages as-is (no sanitizer); (5) tests green. Impact: smaller ui_messages.json, no runtime behavior change for requests. Migration: old metadata fields will be ignored by schema. * Z.ai: add GLM-4.5-X, AirX, Flash (expand model coverage) (RooCodeInc#8745) * feat(zai): add GLM-4.5-X, AirX, Flash; sync with Z.ai docs; keep canonical api line keys * feat(zai): add GLM-4.5V vision model (supportsImages, pricing, 16K max output); add tests * feat(types,zai): sync Z.AI international model map and tests - Update pricing, context window, and capabilities for: glm-4.5-x, glm-4.5-airx, glm-4.5-flash, glm-4.5v, glm-4.6 - Add glm-4-32b-0414-128k - Align tests with new model specs * fix(zai): align handler generics with expanded model ids to satisfy CI compile step * chore(zai): remove tier pricing blocks for Z.ai models * fix(zai): simplify names in zaiApiLineConfigs for clarity * chore(zai): set default temperature to 0.6 --------- Co-authored-by: Roo Code <[email protected]> * Enable browser-use tool for all image-capable models (RooCodeInc#8121) Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: Hannes Rudolph <[email protected]> Co-authored-by: Matt Rubens <[email protected]> * Skip failing tools tests (RooCodeInc#8767) * Update text for clarity in reviewer page (RooCodeInc#8753) * feat: add GLM-4.6-turbo model to chutes ai provider (RooCodeInc#8502) Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com> * web: Dynamic OpenGraph images (RooCodeInc#8773) Co-authored-by: Roo Code <[email protected]> * web: Updates CTA link in /reviewer to send people to /cloud-agents/welcome (RooCodeInc#8774) * feat: add 'anthropic/claude-haiku-4.5' to prompt caching models (RooCodeInc#8764) Co-authored-by: daniel-lxs <[email protected]> * refactor(core): consolidate global custom instructions and improve shell handling * fix: update X/Twitter username from roo_code to roocode (RooCodeInc#8780) Co-authored-by: Roo Code <[email protected]> * fix(zgsm): safely pass optional language metadata to avoid runtime errors * test: update test expectations for shell handling and prompt enhancement * fix: always show checkpoint restore options regardless of change detection (RooCodeInc#8758) * feat: add token-budget based file reading with intelligent preview (
Summary
Changes
Why
Verification
References
Important
Normalizes input token usage in
RooHandlerfor Anthropic models to report non-cached tokens, maintaining provider-agnostic core logic.RooHandlerfor Anthropic models to report non-cached tokens (prompt_tokens - cache_write - cache_read).prompt_tokens.getApiProtocol()inRooHandlerto determine protocol and adjust token reporting.vitest.This description was created by
for 0c4ca55. You can customize this summary. It will automatically update as commits are pushed.