xybio on Discord (#feedback): Claude Code through magpie (127.0.0.1:3425)
shows "We're changing auto mode to no longer charge for classifier
requests ... this session isn't eligible because your requests go through
127.0.0.1:3425". Anthropic's llm-gateway-protocol page asks a gateway to
forward request headers and body fields unchanged (safeguards among them)
and to return replies without dropping keys like safeguard_results or
rewriting tool-use ids.
Audit of the Anthropic-to-Anthropic path (passthrough, forwardOnce):
- Request: anthropic-beta and anthropic-version always go; safeguards and
the dangerous-tool-use beta go as sent to a reviewed route
(serverReview/AutoModeReviewed) and are taken off for any other model.
No body field is dropped there.
- Reply: safeguard_results already pass, whole and streamed
(TestAutoModeServerSideReviewRelayed). tool_use ids go as they came;
toolUseIDs salts one only when the client already holds it (#4910),
which Anthropic's unique ids never are.
- The one rewrite found: anthropicTextCalls (39bade71d, two days old)
reads Claude's <invoke name=…> markup out of a relayed reply's text and
makes it a tool_use with an id magpie invents (call_text_N), stop_reason
tool_use. On a reviewed reply that call has an id Anthropic never
judged, so Claude Code can match it to no verdict.
Fix (textcalls_anthropic.go): a stream whose message_delta carries
safeguard_results, or a whole reply that carries them, has no call read
out of its text; the text goes as text, stop_reason and results as they
came. Without results the written call is still made, so
packinggoodsllc_07668's case (a Claude group writing invokes) is kept.
docs/subsystems/gateway-routing.md says so.
Not changed, said here: masking (redact.MaskJSON, opt-in) masks values
inside safeguards.classifier_context (paths, user_identity) like any other
string the user sends; ids (tool_use_ids, *_id) are kept. Only
Content-Type and request ids are copied from a successful reply's
headers, so anthropic-ratelimit-unified-* don't reach Claude Code. The
wiring leaves the review on whenever a reviewed model is reachable
(claudeReviewEnv), so a session on a non-Claude model, or on a relay that
drops safeguard_results, still gets the notice; which route xybio uses is
not known.
Run (mote-run):
- TestAutoModeReviewedReplyMakesNoCall red with the stream check taken
out (names [Bash], stop tool_use) and with the whole check taken out
(call_text_1 tool_use), green with both.
- At e3f7d3194 (rebased on 2c214ce25): gofmt -l clean; GOOS=linux and
GOOS=windows go vet ./internal/gateway ok; go test -count=1 -timeout
45m ./internal/gateway: every test passed but
TestCodexPoolSaysTheClientsVersion (734.7s), which is #4807.
- Rebased onto origin/main f3335dd1b, which fixes#4807 (17f2387e1) and
changes thinking_bound.go: at the pushed head fe5d30d7c's tree, vet for
linux and windows ok, and -run "TestAutoMode|TestInvokeReported|
TestTextWritten|TestTextCall|TestClaudeBridgeSafeguard|TestCodexPool|
Thinking|TestSafeguards|Passthrough" ok (36.6s). The full package was
not rerun there.
Not tried: a real Claude Code auto-mode session through magpie and its
/status "Auto mode server" row; no real Anthropic reply carrying both
safeguard_results and written invoke text was seen.