fix(users): keep over-ceiling Messages requests native and survive concurrent workflow seeding
Two fixes from pre-release testing of main.
Messages requests above a user-path ceiling stay on the native path. They were sent through the translated pipeline, which dropped anthropic-beta headers, metadata and context_management. Claude Code sends max_tokens of 32000 or more, so any lower ceiling stripped its beta features on every request. The request is now forwarded to Anthropic with only max_tokens, the thinking budget and output_config.effort lowered in the body, using the in-place lowering that native-only requests already had. Side effects:
- A token ceiling alone no longer lowers adaptive thinking from
hightomedium. - A body that spells its limit twice (
MAX_TOKENSandmax_tokens) gets the lowest one in either order. - A request the gateway cannot bring within the ceilings is refused with 400 instead of being translated.
Requests that need the translated pipeline for other reasons (cache, failover, forced effort, guardrail patching) are unchanged. docs/features/users.mdx is updated in all four languages.
Gateways starting together no longer crash while seeding the default workflow. On PostgreSQL, replicas that started at once on an empty database raced to insert the managed default workflow, and the loser exited with a duplicate-key error (5 of 83 starts in testing). The SQL store now retries on a unique violation and finds the version the winner published, as the MongoDB store already did. The new store test fails on PostgreSQL without the retry.
Summary by CodeRabbit
- Bug Fixes
- Eligible Anthropic Messages requests that exceed configured limits stay on native forwarding. Only over-limit token and reasoning settings are reduced; other request details and applicable headers are preserved. When reasoning is disabled by the configured limit, thinking is turned off.
- Improved reliability when concurrent operations create or update the managed global default.
- Documentation
- Clarified how native forwarding handles limits and which requests continue to use the translated path.