Repository navigation
Description
Area
Routing / combos, Claude Messages ingress
What are you trying to accomplish?
Run Claude Code through a combo/* route (for example Anthropic OAuth pool first, Codex as fallback) without losing Anthropic prompt caching or Anthropic-native behaviour when the Anthropic child is the one that serves the turn.
What prevents this today?
nativeMessagesDeclineReason (src/server/messages-native-eligibility.ts:141) declines every combo or policy route (combo-or-policy-route), because the combo owns multi-candidate execution in the Responses pipeline. So a combo whose winning child is plain api.anthropic.com still goes Messages -> Responses -> Messages. On long Claude Code sessions this costs real quota:
- The re-serialised request does not byte-match what the client sent, so the cached prefix stops early. In our deployment, routed Opus turns read only a ~221K-token cached prefix while 500K-685K input tokens per turn were billed uncached. The same session on the direct native lane reads almost all of it from cache.
- Anthropic-native tools (
bash_*,text_editor_*,mcp_servers) are dropped silently on the translated path instead of failing closed. citations_delta,stop_sequenceand unknown server blocks are not relayed verbatim.- Only
usage.server_tool_use.web_search_requestsreaches the client (src/claude/outbound.ts:167), soweb_fetch_requestsand the like undercount on routed turns.
What should OpenCodex do?
When a combo child resolves to the canonical Anthropic Messages endpoint and the request would otherwise be native-eligible, dispatch that child through the managed native lane with the caller's original bytes, while the combo keeps ownership of candidate order, failover and attempt booking. Concretely:
- The combo runner asks the native lane to execute one child and gets back the same success/failure classification it uses today (so failover to a non-Anthropic child still works).
- The request snapshot is taken before any effort rewrite, so a replay is byte-identical.
- Usage is booked to the combo attempt, and the full
server_tool_usemap is forwarded. - Behind the existing
protocols.rollout.managedMessagesNativeswitch, default unchanged.
Example usage or interface
No new config. With managedMessagesNative on, ANTHROPIC_MODEL=combo/waterfall and waterfall = [anthropic/claude-opus-5-5, openai/gpt-6.1-sol]: when the Anthropic child serves the turn, cache reads match the direct anthropic/claude-opus-5-5 route. When it is refused, failover to Sol is unchanged.
Alternatives or workarounds
- Point Claude Code at
anthropic/...directly. This loses failover. - We have carried a fork implementation for several weeks (Anthropic source replay inside the combo pipeline, about 3-4K lines plus tests). It works, but it conflicts with the PF-08/PF-10 native lane design, so we would rather agree on the shape here before splitting it into reviewable PRs.
Additional context
Happy to do the work as a series of small PRs once the maintainers confirm the direction, or to drop it if combos must stay translated by design. If so, could the reason be documented next to combo-or-policy-route?
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
🤖 Generated with Claude Code
Activity
github-actions commentedon Oct 19, 2026
Automated translation bookkeeping — detected language: English.
Ingwannu commentedon Oct 19, 2026
Linked the first narrow implementation in Draft #7374. It reuses the existing native Messages executor under strict failover/canonical-child/no-effort exclusions rather than importing the fork replay pipeline. That is a concrete proposal for review, not approval of native auth/lease/replay ownership or a measured cache-performance result. Owner disposition still needs to cover source-byte capture before policy rewrites, native-only tool portability on fallback, exactly-once usage/lease settlement and cancellation/commit boundaries. Marking needs-design and leaving this open; no paid native request or live cache renewal was run.
feat(combo): preserve native Messages replay
feat(combo): preserve native Messages replay
feat(combo): preserve native Messages replay
feat(combo): preserve native Messages replay
feat(combo): preserve native Messages replay
lidge-jun commentedon Nov 15, 2026
#7374 is on
dev. When a strictfailovercombo's canonical Anthropic child serves a Messages caller, the child now replays the caller's own Messages envelope through the native executor instead of Messages → Responses → Messages, so the cached prefix survives. Native-only tools fail closed on fallback, and usage and leases settle exactly once. Policy/JEV strategies, combo effort rewrites and Fast rows keep the translated path on purpose. This is the deployment in the report (Anthropic first, Codex fallback), so I'm closing. If you need native replay under another strategy, please open a new issue naming it.