The Library's billion-context tab puts Claude Code behind bili's lane:
ANTHROPIC_BASE_URL http://127.0.0.1:18787/bili/http://127.0.0.1:3425,
which forwards to the gateway. A local proxy with a path is checked by
asking GET / there for magpie's info (#1985), and a bili lane runs only
beside its agent, so the probe said no: the Agents page showed "配置已变更"
with Reconnect, which would have written the gateway over the user's
billion-context.
chainsToGateway (reach.go): an address on this machine's loopback whose
path ends in the gateway's own URL (/bili/<gw>, /bili/anthropic/<gw>, any
port) reaches magpie without a probe. reachesMagpie and surelyMagpie take
it, so every agent's drift check (wiringOff, Claude's managed settings,
Reasonix, T3 Code, Zed) holds, and Claude Code's writes (a pick,
Reconnect) keep ANTHROPIC_BASE_URL on the lane (gwAt/claudeProxied).
The sync's kept-away filter (keptaway.go) kept nothing for a file that
already named the gateway: chainPrefix now keeps one such proxy in front
of the gateway wherever the file had it, for every agent's sync.
Codex is left as it was: its openai_base_url check is exact, and bili's
Codex lane is an MCP server that never takes this address.
Run (mote):
- go test -run 'TestBiliChain|TestChainsToGateway|TestClaudeBehindBili' ./internal/agent: ok
- go test -run 'TestBiliChain|TestChainsToGateway|TestReverseProxy|TestClaudeManagedProxy|Kept|Away|Elsewhere|Proxy' ./internal/agent: ok
- gofmt -l clean; go vet ./internal/agent for darwin, linux (nogui) and windows
Broken by hand: chainsToGateway taken out of reachesMagpie/surelyMagpie
and chainPrefix off: TestBiliChainIsStillMagpie red with the reporter's
exact message for claude, claude-desktop, gemini, opencode and others,
53 files back on the gateway after a sync; TestClaudeBehindBiliLaneKept
red.
Not tried: a real bili lane with a real Claude Code; the full suite
(started after the tag).