Repository navigation
fix(anthropic): accept system messages without legacy beta - #408
Conversation
astaxie
left a comment
There was a problem hiding this comment.
Reviewed the complete six-file diff at 8e91601e0dbcb33bd21786cf2df7fbe95c7f3647 against the PR base and the explicitly scoped admission part of #404.
Standards
No actionable findings. The English, Simplified Chinese and Japanese guides consistently describe the support boundary, and the new regressions use synthetic upstream fixtures.
Spec and behavior
No actionable implementation defect found. The change removes the obsolete beta-token admission requirement while preserving supported-role validation, authentication, model authorization, quota reservation, guardrail traversal, native payload/header forwarding and ordered OpenAI conversion. The separate limitation of upstreams that reject mid-conversation system messages is explicitly deferred and documented.
Validation
A focused go test -p 1 ./internal/server run compiles the complete server test package and passes the new 12-case native/OpenAI-compatible, beta-header and streaming matrix, token-count regression, unsupported-role rejection, and existing system-conversion/native-streaming coverage. The full backend suites, local PostgreSQL checks and live vendor SDK tests were not rerun.
GitHub reports no checks on this exact PR head. The fork-only validation described in the PR uses a different commit and is not treated as exact-head CI success; merge validation therefore remains pending. Independent retrieval of the linked Anthropic documentation failed with a TLS error, so this review does not claim to have independently verified its current remote wording. No workflow was approved or triggered.
Standards: 0 findings. Spec/behavior: 0 findings.
Summary
Allow mid-conversation
systementries at the Anthropic Messages admission boundary without requiring the legacymid-conversation-system-2026-04-07beta header. Current Claude Code requests omit that header, so the gateway rejects them before selecting an upstream route.Anthropic's current documentation no longer requires a beta header for basic mid-conversation system messages on supported models.
Related Issue
Related to #404 — addresses the gateway admission failure only. This intentionally does not resolve the separate compatibility problem for OpenAI-compatible upstreams that prohibit system messages after the first turn.
Changes
user,assistant, andsystemroles independently of the legacy beta token; continue rejecting other roles.Type of Change
Verification
400 invalid_messagebefore the fix, while four legacy-header route cases pass. The patched production passes all cases; unsupported roles remain rejected.go veton the same production/test file-list passes.41014952914, on validation headea89113dd7185aa5ac7ada9e3b12ed2681b14405: all four backend shards (including full vet and pinned golangci-lint), Plugin DevKit, PostgreSQL, database N-1 compatibility, Frontend, Frontend browser smoke, Deployment, Repository gates, and the CI aggregate completed successfully (12/12 jobs). Browser smoke was checked separately because the aggregate does not depend on it.8e91601e0dbcb33bd21786cf2df7fbe95c7f3647. The validation head differs only by a fork-only CI adapter: three historical release checkout steps explicitly read the upstream repository at the official v0.4.0/v0.5.0 commit SHAs because this fork has no release tags. All test commands, jobs, pinned actions, and permissions are unchanged; the adapter is excluded from this upstream PR.Compatibility, Security, and Operations
/v1/messagesand/v1/messages/count_tokens; no authentication, model authorization, quota, persistence, environment, or deployment changes.Checklist
.envfiles, databases, backups, or runtime logs are included.start.sh, and deployment documentation where applicable. (No environment changes.)data/model-catalog.yamlremains tracked and catalog changes were reviewed where applicable. (Catalog unchanged.)git diff --checkpasses.