Skip to content

fix(moa): preserve provider identity for anthropic + bedrock slots - #55897

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-21bc0d78
Jul 1, 2026
Merged

teknium1 merged 4 commits into
mainfrom
hermes/hermes-21bc0d78

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

MoA reference/aggregator slots for anthropic and bedrock now keep their provider identity instead of being flattened to a generic custom endpoint — so OAuth-token / SigV4-signed auth actually fires.

Salvages two external PRs (#54609 by @jackroofan, #54912 by @iizotov), both extending the _slot_runtime name-preservation set. Closes #55452 (duplicate of #54609's anthropic fix).

Root cause

agent/moa_loop.py::_slot_runtime resolves a slot through resolve_runtime_provider and forwards base_url/api_key to call_llm. call_llm treats an explicit base_url as a custom endpoint, which skips the provider branch that adds auth headers / request signing. That's correct for plain OpenAI-compatible targets but wrong for two providers:

  • anthropic — subscription OAuth setup-tokens (sk-ant-oat*) require Bearer auth plus the anthropic-beta: oauth-* header, added only by the anthropic provider branch. Forwarded → the token is sent as x-api-key → Anthropic returns a bare 429.
  • bedrock — the provider branch builds an AWS-SigV4-signed client; resolve_runtime_provider returns a placeholder api_key ("aws-sdk"), not a real bearer. Forwarded → unsigned POST → empty/malformed ChatCompletion.

This is the same class already handled for {nous, openai-codex, xai-oauth}.

Changes

  • agent/moa_loop.py: add anthropic and bedrock to the _slot_runtime name-preservation set (union of the two PRs), with rationale comments for each.
  • tests/run_agent/test_moa_loop_mode.py: anthropic's dedicated name-preserve test (from fix(moa): route native anthropic OAuth references through provider branch #54609) lands; drop anthropic from the pre-existing test_moa_provider_backed_slot_survives_aux_resolution parametrize (it asserted the old forward path — now superseded; minimax-oauth/qwen-oauth still forward and remain).
  • scripts/release.py: AUTHOR_MAP entries for both contributors.

Validation

Before After
anthropic OAuth MoA slot bare 429 (token sent as x-api-key) routed through provider branch (Bearer + oauth-beta)
bedrock MoA slot empty/malformed response (unsigned POST) routed through signed bedrock branch
tests/run_agent/test_moa_loop_mode.py 20/20 pass

Contributor authorship preserved (rebase-merge).

Infographic

MoA slot identity name-preservation

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/anthropic Anthropic native Messages API provider/bedrock AWS Bedrock (boto3, IAM) labels Jun 30, 2026
Chufeng Fan and others added 4 commits June 30, 2026 17:34
…anch

MoA's _slot_runtime() whitelists providers that must keep their provider
identity (so call_llm runs their provider branch) instead of being treated
as a plain custom endpoint via forwarded base_url/api_key. Native anthropic
was missing from this set.

Native anthropic subscription OAuth setup-tokens (sk-ant-oat*) require Bearer
auth plus the 'anthropic-beta: oauth-*' header, which only the anthropic
provider branch adds. Without the whitelist entry, the slot's base_url/api_key
were forwarded and call_llm sent the OAuth token as x-api-key, which Anthropic
rejects with a bare 429 (rate_limit_error with no quota details). This made
anthropic references in MoA presets fail every time.

Add 'anthropic' to the whitelist so native anthropic reference/aggregator
slots route through the provider branch. Extends upstream 9229d0d which
added 'nous' for the same reason.
_slot_runtime() resolved a bedrock slot to its bedrock-runtime base_url
plus the placeholder api_key "aws-sdk" and forwarded both to call_llm.
call_llm then treated it as a plain OpenAI-compatible endpoint and issued
an UNSIGNED bearer POST (no AWS SigV4 / IAM signing), so Bedrock returned
an empty/malformed ChatCompletion (choices=None) and the MoA aggregator
turn failed validation.

Add 'bedrock' to the name-preserve set alongside nous/openai-codex/
xai-oauth so bedrock slots are passed by provider name only, routing
through call_llm's dedicated SigV4-signed bedrock branch.

Affects any MoA preset using a bedrock aggregator or bedrock reference.
…e-preserve

#54609 moves anthropic into the _slot_runtime name-preservation set (it must
NOT forward base_url/api_key — OAuth sk-ant-oat* needs the provider branch's
Bearer + anthropic-beta header). The pre-existing parametrized
test_moa_provider_backed_slot_survives_aux_resolution still listed anthropic
asserting the forward path, contradicting the new behavior. anthropic is now
covered by test_slot_runtime_anthropic_oauth_routes_through_provider_branch;
drop it from the forward-path parametrize (minimax-oauth/qwen-oauth remain).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/anthropic Anthropic native Messages API provider/bedrock AWS Bedrock (boto3, IAM) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants