Files
magpie/internal
ggbdpq ee031e9539 gateway: a billion-context proxy in front of the provider gets the client's x-bili- headers (#3052)
What changed: forwardOnce copies the client's x-bili-* headers on to the
request it builds for the provider, by a biliHeader predicate beside
claudeCodeHeader and codexClientHeader — an x-bili- prefix, in the shape
of the anthropic-, x-stainless-, x-claude-code-, x-openai- and x-codex-
families already on the allowlist. The headers carry the cooperative
plugin's name, conversation and context window, never a key; a header no
family allowlists, and the client's own key, still stay off.

Why: forwardOnce builds the upstream request from nothing and copies only
allowlisted headers, so a client talking to a billion-context (bili)
proxy put in front of its provider lost the x-bili- ones that name its
cooperative session — bili then saw an anonymous session and injected a
duplicate set of compression tools beside the plugin's own (#3052).
Whether to generalize this into a per-provider "pass-through client
headers" setting, beside PassUserAgent (#1851) and a provider's own
Headers, is the maintainer's call; this change only admits the family
the issue reports.

Run: go test -run TestForwardOnceCarriesBiliHeaders ./internal/gateway
fails on the baseline with the three headers empty and passes with the
change (httptest, no network); ablation (product file back at baseline,
test kept) fails again. gofmt -l clean; go vet ./..., GOOS=linux and
GOOS=windows go vet -tags nogui ./... clean; native, GOOS=linux -tags
nogui and GOOS=windows builds clean; go test -tags nogui
./internal/gateway green.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-01 10:22:56 +08:00
..
…
…
…
…
…