fix: preserve Bedrock model ID dots in normalization pipeline#10772
Closed
ptlally wants to merge 1 commit into
Closed
fix: preserve Bedrock model ID dots in normalization pipeline#10772ptlally wants to merge 1 commit into
ptlally wants to merge 1 commit into
Conversation
Bedrock model IDs use dots as vendor separators (e.g. anthropic.claude-sonnet-4-6), but normalize_model_name() was replacing all dots with hyphens, producing invalid IDs like anthropic-claude-sonnet-4-6. Root cause: _anthropic_preserve_dots() in run_agent.py did not include 'bedrock' in its provider set, so the anthropic_messages path called normalize_model_name() with preserve_dots=False. Fix: - Add 'bedrock' to _anthropic_preserve_dots() provider set so Bedrock model IDs keep their vendor dot separators through the Anthropic Messages API adapter. - Add 'bedrock' to _AUTHORITATIVE_NATIVE_PROVIDERS in model_normalize.py so Bedrock model IDs pass through startup normalization unchanged. Covers standard (anthropic.claude-*), cross-region (us.anthropic.claude-*), and versioned (anthropic.claude-*-v2:0) model ID formats. Tests: 22 new parametrized tests for bug condition + preservation.
This was referenced Apr 16, 2026
2 tasks
19 tasks
Author
|
Issue resolved with PR #12793, thanks Tek :) Closing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bedrock model IDs use dots as vendor separators (e.g.
anthropic.claude-sonnet-4-6), butnormalize_model_name()was replacing all dots with hyphens, producing invalid IDs likeanthropic-claude-sonnet-4-6.Root cause:
_anthropic_preserve_dots()inrun_agent.pydid not include"bedrock"in its provider set, so theanthropic_messagespath callednormalize_model_name()withpreserve_dots=False.Fix:
"bedrock"to_anthropic_preserve_dots()provider set so Bedrock model IDs keep their vendor dot separators through the Anthropic Messages API adapter."bedrock"to_AUTHORITATIVE_NATIVE_PROVIDERSinmodel_normalize.pyso Bedrock model IDs pass through startup normalization unchanged.Covers standard (
anthropic.claude-*), cross-region (us.anthropic.claude-*), and versioned (anthropic.claude-*-v2:0) model ID formats.Tests: 22 new parametrized tests for bug condition + preservation.
Note: Bedrock's inference profile requirement (needing
us.anthropic.claude-*instead of bareanthropic.claude-*for on-demand throughput) is a separate issue — this PR only fixes the dot-mangling that broke Anthropic/Claude model IDs on the Bedrockanthropic_messagespath. Non-Claude Bedrock models (Nova, Llama, etc.) use thebedrock_conversepath and were unaffected. Users can work around the inference profile issue by setting the full model ID (e.g.us.anthropic.claude-sonnet-4-6) in config.yaml.What does this PR do?
When provider is
bedrockand a Claude model is detected, hermes routes through theanthropic_messagesAPI mode using the AnthropicBedrock SDK. The model ID (e.g.anthropic.claude-sonnet-4-6) flows throughnormalize_model_name()withpreserve_dots=False, which replaces the vendor dot separator with a hyphen. The resultinganthropic-claude-sonnet-4-6is not a valid Bedrock model identifier, causing API calls to fail with a 400.Non-Claude Bedrock models (Nova, DeepSeek, Llama, etc.) use the
bedrock_conversepath and were not affected by this bug.This PR adds
"bedrock"to two existing provider sets so Bedrock model IDs pass through both normalization layers unchanged. The Anthropic SDK itself does no model ID normalization — it just URL-encodes the model for the Bedrock invoke path — so the fix is entirely within hermes.Related Issue
N/A — discovered during Bedrock provider testing.
Type of Change
Changes Made
run_agent.py: Added"bedrock"to the provider set in_anthropic_preserve_dots()(~line 6295)hermes_cli/model_normalize.py: Added"bedrock"to_AUTHORITATIVE_NATIVE_PROVIDERS(~line 88)tests/agent/test_anthropic_adapter.py: AddedTestBedrockDotPreservation(5 tests) andTestNonBedrockPreservation(11 tests)tests/hermes_cli/test_model_normalize.py: AddedTestBedrockModelIdPreservation(4 tests) andTestNonBedrockPreservation(3 tests)How to Test
provider: bedrockand a Claude model (e.g.us.anthropic.claude-sonnet-4-6)hermesand send a message — the API call should succeed without model ID errorsprovider: anthropicwithclaude-sonnet-4.6should still normalize toclaude-sonnet-4-6)python -m pytest tests/agent/test_anthropic_adapter.py tests/hermes_cli/test_model_normalize.py -q— 172 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Before fix:


After fix (with inference profile model ID

us.anthropic.claude-sonnet-4-6):Model ID passes through unchanged, API calls succeed.