mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7926] [MERGED] fix(claude-subscription): drop the extra history cache marker; keep Claude Code's marked turn stable #8007
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#8007
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/7926
Author: @stonebystone
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/claude-sub-cache-marker-limit📝 Commits (2)
9aa8a22fix(claude-subscription): drop the extra history cache marker; keep Claude Code's marked turn stablefa90692Merge branch 'staging' into fix/claude-sub-cache-marker-limit📊 Changes
4 files changed (+55 additions, -104 deletions)
View changed files
📝
docs/connections/subscription-clis.md(+0 -2)📝
packages/server/src/services/llm/providers/claude-subscription.provider.ts(+4 -13)📝
packages/server/src/services/llm/providers/claude-subscription/jsonl-entries.ts(+21 -23)📝
scripts/regressions/claude-subscription-cache.regression.ts(+30 -66)📄 Description
Linked issue
Closes #7925
Why this change
#7866 broke Claude (Subscription) for anyone with the 1-hour cache on. Every request fails with "A maximum of 4 blocks with cache_control may be provided. Found 5." Claude Code already places four cache markers itself (two on the system prompt, two on the last two messages), so the extra one #7866 added is one too many.
It also turns out the extra marker was never needed. Claude Code already marks the last history entry (the previous reply). That entry didn't match the next request only because the xml wrap appends
</chat_history>to it, and the tag moves to the next reply every turn.What changed
assembleEntriesno longer addscache_control, and the provider no longer passes one. The debug line returns to its earlier form.splitHistoryForResume(claude-subscriptionjsonl-entries.ts): when the last history entry ends with the xml</chat_history>close, the tag moves to the start of the current turn. The model sees the same text in the same order. The entry Claude Code marks is now identical in the next request, so the history is read from cache.docs/connections/subscription-clis.md: removed the paragraph #7866 added, since history reuse no longer depends on the 1-hour setting. #7867 (its translation follow-up) is no longer needed.claude-subscription-cacheregression: checks the tag move, that unwrapped history is left alone, and that the resumed history carries nocache_control.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks (for the reviewer, not ticked above):
pnpm check: passes (one existing client lint warning, unrelated).claude-subscription-cacheregression passes, and fails with the tag move removed. The other five Claude regressions pass.The failing prompt from a real chat (97 messages, Opus 5.5, 1-hour cache on) fails with "Found 5" on staging and succeeds with this branch, both run with the desktop app's environment variables removed.
Live run against a real subscription, server-like environment (Opus 5.5, 26k-token prompt, xml-style
</chat_history>on the last history entry):The same run with the 1-hour cache on gave the same pattern. History reads start on the third turn. The first turn writes roughly twice the prompt and the second reads nothing; I haven't traced why.
Manual verification notes
tokensCachedPromptclose to the prompt size), with the 1-hour cache on and off.</chat_history>where it did before (this change only affects the request sent to Claude Code).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)cc @SpicyMarinara
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.