Seapawn1 on X: GPT in Claude Code loses its prompt cache with tool search
on. A tool ToolSearch loads joined the top-level tools on the next request
on every route but Anthropic's and a Responses upstream that loads in
place (LoadedInPlace, #2660). An OpenAI-style cache is a prefix with the
tools before the messages, so each load (2.1.327 defers WebFetch,
WebSearch, Monitor and the other built-ins too) read the whole
conversation again uncached. A sandboxed Claude Code 2.1.327 through a
fake upstream showed it: on Chat and on a Responses relay the tools
changed at req1 and req3; in place they held.
On such a route a Claude Code request carrying DeferredToolPlaceholder is
answered 400 invalid_request_error naming tools.defer_loading, locally.
The real Claude Code 2.1.327 answers that (after its beta-strip retries,
3 refused requests) by declaring every tool in full for the rest of that
conversation, --continue included; a new conversation, on a Claude model,
tries tool search again. The message doesn't name the beta header, which
Claude Code would remember everywhere. Only while the reminder names 50
deferred tools or fewer: an MCP router's hundreds keep tool search, and a
request whose reminder can't be read keeps it too. Anthropic routes and
in-place Responses upstreams are unchanged. The refusal is not a member's
fault (retryable/shapeRefused false), so a group doesn't fall over or
rest.
Not handled: a user who set ENABLE_TOOL_SEARCH themselves can't be told
apart on the wire; additional-tools=on keeps search on a relay that takes
the item.
Run:
- mica: go test -run 'TestDeferred|TestLoadedTools|TestKimiIsSent|TestToolSearch|TestDeferredToolBlocks' ./internal/gateway ok.
- Broken by hand (the check in translate made false): TestDeferredToolsTurnedAwayWhereTheyLoseTheCache and TestDeferredToolsKeptWhereLoadedInPlace red (status 200, upstream called).
- mica: GOOS=linux and GOOS=windows go vet ./internal/gateway ./internal/agent ok; gofmt -l clean.
- wsl-run (magpie-desktop): go test -timeout 45m ./internal/gateway ./internal/agent started before push; result with the full suite.
- Real Claude Code 2.1.327 in a sandbox HOME against a fake 400 naming defer_loading: retried with every tool declared, kept for the conversation and --continue, new conversation searched again.
Full suite: run after push.