mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5764] [MERGED] fix: include Anthropic cache tokens in context usage #6922
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6922
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5764
Author: @Gunterlie
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @Gunterlie
Base:
staging← Head:fix/5763-anthropic-context-usage📝 Commits (4)
ba4b90afix: include Anthropic cache tokens in context usage8fd9c34fix: preserve cache-only Anthropic usagea8d21aatest: cover streamed Anthropic cache usagee89f536Merge remote-tracking branch 'origin/staging' into fix/5763-anthropic-context-usage📊 Changes
5 files changed (+129 additions, -18 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/client/src/lib/professor-mari-context-budget.ts(+5 -3)📝
packages/server/src/services/llm/providers/anthropic.provider.ts(+34 -12)📝
scripts/regressions/open-issues.regression.ts(+20 -0)📝
scripts/regressions/provider-compat.regression.ts(+69 -3)📄 Description
$Fixes #5763\n\n## Summary\n- Persist Anthropic cache-read and cache-write input token usage for streamed and non-streamed responses.\n- Include cached prompt tokens in the active context indicator.\n- Add regression coverage for long cached contexts.\n\n## Why\nAnthropic reports cached prompt input separately from fresh input. The indicator previously showed only the fresh portion, so long chats could show values such as 3.5k even when the model received a much larger active context.\n\n## Known limitation\nExisting assistant messages from older builds do not contain the omitted cache fields. A new generation after this fix stores the complete usage data.\n\n## Test plan\n- [x] Run the focused open-issue regression.\n- [x] Run lint, type checks, localization checks, and formatting checks through
pnpm checkuntil the production build.\n- [ ] Manually verify a long cached Anthropic chat in the browser.\n- [ ] Manually verify the indicator in light mode, dark mode, and a mobile viewport.\n- [ ] Confirm all required CI checks and CodeRabbit review.\n\nThe client production build exceeded the local 120-second command timeout after the server build completed. It did not report a compile error.Summary by CodeRabbit
New Features
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.