Skip to content

fix(auxiliary): only rewrite /anthropic to /v1 for dual-surface hosts (salvage #83782) - #85532

Merged
teknium1 merged 3 commits into
mainfrom
salv-83782
Aug 13, 2026
Merged

fix(auxiliary): only rewrite /anthropic to /v1 for dual-surface hosts (salvage #83782)#85532
teknium1 merged 3 commits into
mainfrom
salv-83782

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

_to_openai_base_url now rewrites /anthropic/v1 ONLY for known dual-surface hosts (MiniMax family; ZAI /paas/v4 mapping kept) — Anthropic-only gateways like Bailian /apps/anthropic keep their path. Salvage of #83782 by @686f6c61 onto current main, authorship preserved. Fixes #83642.

This is the class-wide completion of the #85466 point fix: it reaches the aux-iteration call sites and API-key branch where no api_mode is in scope, which per-site guards could not.

Changes

  • agent/auxiliary_client.py: rewrite policy inverted to a dual-surface host allowlist; fixup (ours): marker matching host-anchored via urlparse (exact/subdomain suffix match) — a URL whose path contains api.minimax no longer false-positives
  • Tests: dual-surface rewrite cases, Bailian path-kept case, path-marker false-positive case, lookalike-suffix host case; test_auxiliary_explicit_base_anthropic.py aligned with the new policy
  • Dropped from the original PR: an unrelated test_multiplex_busy_input_mode.py fixture hunk — already fixed on main via f51aa6a

Validation

Before After
Bailian /apps/anthropic on aux calls rewritten to /apps/v1 → 404 path kept
MiniMax dual-surface rewritten (works) rewritten (unchanged)
api.minimax appearing in a path would rewrite no false-positive
targeted tests 20/20, 3 sabotage-verified

Note for merge: unknown dual-surface gateways (e.g. a LiteLLM proxy exposing both wire formats under /anthropic) now keep their path on OpenAI-wire aux calls; wrap-detection routes such URLs to the native transport in practice.

Infographic

dual-surface rewrite policy

686f6c61 and others added 3 commits August 13, 2026 11:21
Unconditionally rewriting any */anthropic base_url to /v1 broke
Anthropic-only custom gateways (e.g. Alibaba Bailian Token Plan) used by
auxiliary compression/vision under provider=auto. Keep MiniMax dual-surface
hosts rewriting; leave pure Anthropic paths intact.

Fixes #83642
Substring matching over the whole URL let a path containing
'api.minimax' false-positive an Anthropic-only gateway into the
/anthropic→/v1 rewrite. Parse the host and match exact-domain /
subdomain suffixes (plus the api.minimax.* prefix family) instead.
…ewrite policy

Unknown hosts (e.g. gateway.example.com) no longer get /anthropic→/v1;
use a real dual-surface MiniMax base for the rewrite assertions and add
a case proving Anthropic-only gateways keep their path on the OpenAI wire.
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 2a38cd1 — test(agent): align explicit-base auxiliary tests with host-a

⚠️ Warnings

CI timings · View report · View job

Wall time 13m30s vs 9m28s (+42.6%). 8 job(s) slower, 14 faster, 2 unchanged.

  • Python tests / Run tests slice 7/12: +24.0s
  • Python tests / Run tests slice 6/12: -20.0s
  • Python tests / Run tests slice 10/12: -20.0s
  • Python tests / Run tests slice 5/12: -18.0s
  • Python tests / Run tests slice 3/12: +18.0s

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/config Config system, migrations, profiles provider/anthropic Anthropic native Messages API provider/minimax MiniMax (Anthropic transport) provider/zai ZAI provider sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 13, 2026
@686f6c61

Copy link
Copy Markdown
Contributor

Thanks for the salvage onto current main — and for tightening host-anchored marker matching so a path containing api.minimax cannot false-positive.

Closing #83782 as superseded by this tip. The dropped multiplex busy-mode fixture hunk was indeed already covered on main.

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

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/anthropic Anthropic native Messages API provider/minimax MiniMax (Anthropic transport) provider/zai ZAI provider sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: auxiliary auto endpoint rewrite breaks Anthropic-only custom gateways (compression/vision 404)

3 participants