Skip to content

Combo routes: let an Anthropic child replay the caller's Messages bytes (native lane) instead of re-translating them #7350

Closed

Description

@vadymhimself

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_sequence and unknown server blocks are not relayed verbatim.
  • Only usage.server_tool_use.web_search_requests reaches the client (src/claude/outbound.ts:167), so web_fetch_requests and 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:

  1. 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).
  2. The request snapshot is taken before any effort rewrite, so a replay is byte-identical.
  3. Usage is booked to the combo attempt, and the full server_tool_use map is forwarded.
  4. Behind the existing protocols.rollout.managedMessagesNative switch, 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

  1. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. added
    enhancement
    account-pool
    on Oct 19, 2026
  3. Ingwannu commented on Oct 19, 2026

    @Ingwannu
    Owner

    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.

  4. added
    needs-design
    on Oct 19, 2026
  5. lidge-jun commented on Nov 15, 2026

    @lidge-jun
    Owner

    #7374 is on dev. When a strict failover combo'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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolenhancementneeds-design

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions