parseTranslated (the commit before, #4571) reads an Anthropic ask to an
Anthropic upstream with parseAnthropicRequest(body, true), which skipped
what parseRequest does after its reader: unsignCalls, LastIsTurn and the
required-tool-choice check. A call id carrying a Gemini thought
signature, from a turn a Gemini member of a group answered, went to the
upstream signature and all whenever the ask carried cache_control. Both
parses now end in afterParse.
Also from review: translate's doc comment had been left above
cacheControlField, and ir.go still said clientCache is only the Claude
bridge's opt-in.
TestTranslatedWithMarksTakesSignaturesOffCallIDs is red with
afterParse's call taken out of parseTranslated (the id comes back
signed) and green with it.
Run for this batch (f600fb982..this commit), all on mote:
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) at
6a900e0d0 plus these six commits: 81 packages ok, two red, both
already filed on main and in packages this batch doesn't touch:
internal/cli TestLibraryMCPHub (#4140, npm still writing into the
test's HOME at TempDir cleanup) and internal/gui
TestSettingsSaveKeepsWhatItDoesNotSend (#4514, SearchAll).
- After rebasing onto 0fe9f97c1: go vet -tags nogui ./... ok;
internal/gateway, internal/agent, internal/library and
internal/provider ok.
- gofmt -l clean. GOOS=linux (nogui) and GOOS=windows vet clean.
- Rebased again onto 80af3b86a (main's 20482d71f also changes
skills.go and skillnew.go; the merge was clean and #4572's hunks are
unchanged): gofmt -l clean, go vet -tags nogui ./internal/... ok,
internal/library and internal/gateway ok at this head.
- Rebased onto 0565c0bba (main's e40675cc1 also changes gateway.go;
the hunks merged clean): gofmt and go vet ./internal/... ok; gateway
-run Translated|Cache|Effort|Gemini|Account|Middleware|Browser|
Thinking|Plugin, agent -run OpenCode|Codex|Sync|Image|Group, and all
of internal/library ok. TestBrowserExtensionOnlyFromItsOrigin is red
on 0565c0bba alone, 3 of 3 (#4631), and was skipped.
A plugin account only streams, so a client's whole-body Anthropic
Messages ask is translated: parsed into the request, built again for the
upstream, asked streamed and its answer assembled into one Message JSON.
The parse read none of the cache_control the client had put on its
blocks, and the build set its own marks — the system and the last block
of the last message, five minutes long. A client that marked the end of
its history, as Claude Code's auto mode classifier does, found that
boundary gone from the rebuilt body: the next turn, its history grown by
a block or two, matched only the fixed prefix up to the system block and
wrote the whole transcript again, and every write went out at five
minutes where the client had asked for an hour. The same ask with
stream:true is relayed as it came and shows none of it.
A translation of Anthropic's own now reads the request with its marks
(#3835's path) and the rebuild keeps them: a block the client marked is
marked again, the tail and the system take the client's ttl, and none of
magpie's own are added, so the mark that moves on with the history
stands at the same block the next turn. A mark on thinking, which
Anthropic does not mark, and one on a block the rebuild drops, are left
out. A set that fails the checks any Messages request must pass goes the
default way, its marks dropped as before, not refused with a 400 the old
translation never gave.
Run (macOS):
- Red before, green after: TestPluginWholeAskedKeepsTheClientCacheMarks
(the boundary unmarked and both marks ttl-less on main, the client's
blocks otherwise kept 1:1), TestPluginWholeAskedServesBadMarksAsBefore
green before and after.
- go test -tags nogui -count=1 ./internal/gateway: ok.
Issue #4571
Generated-by: GLM-5.3-Flash (ZCode)
Broken by hand: with the anthropic.go hunks reverted,
TestPluginWholeAskedKeepsTheClientCacheMarks is red: the boundary is
unmarked, and the tail and system are ttl-less. Matches devin plugin
0.1.29 (30cd39f19, plugins#566), which carries the client's
cache_control into its prompt cache options: the marks now reach the
plugin. The next commit fixes this one's parse skipping unsignCalls.