Skip to content

fix(bedrock): inherit modalities for inference profiles + detect AWS creds in /model picker#11132

Closed
JiaDe-Wu wants to merge 3 commits into
NousResearch:mainfrom
JiaDe-Wu:fix/bedrock-profile-modalities
Closed

fix(bedrock): inherit modalities for inference profiles + detect AWS creds in /model picker#11132
JiaDe-Wu wants to merge 3 commits into
NousResearch:mainfrom
JiaDe-Wu:fix/bedrock-profile-modalities

Conversation

@JiaDe-Wu

@JiaDe-Wu JiaDe-Wu commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Three Bedrock fixes based on community and colleague feedback:

1. Inherit modalities from foundation models for inference profiles

Inference profiles (us.*, global.*) returned by discover_bedrock_models() were hardcoded to ["TEXT"] input/output modalities. Claude inference profiles (which support IMAGE input) lose that capability in discovery results.

Fix: Build a foundation model lookup map after discovery, resolve the underlying model via ARN, and inherit its modalities.

Reported by @ptlally in PR #7920.

2. Detect AWS credentials in /model provider picker

list_authenticated_providers() only checked API keys and auth stores, missing Bedrock's aws_sdk auth type. Running /model (no args) would show "No authenticated providers found" even with valid IAM credentials.

Fix: Add has_aws_credentials() check in the CANONICAL_PROVIDERS loop.

3. Add Bedrock auxiliary client for context compression

resolve_provider_client() in auxiliary_client.py had no aws_sdk auth branch, so Bedrock users got "No auxiliary LLM provider configured" on startup. Context compression fell back to dropping middle turns without summaries.

Fix: Add aws_sdk auth branch using AnthropicBedrock SDK, register default aux model (claude-haiku-4-5), and thread preserve_dots=True through the adapter chain so Bedrock model IDs (which use dots as vendor separators) aren't mangled.

Changes

  • agent/bedrock_adapter.py — Build _foundation_modalities lookup map for inference profiles
  • hermes_cli/model_switch.py — Add Bedrock AWS credential detection in list_authenticated_providers()
  • agent/auxiliary_client.py — Add aws_sdk auth branch, preserve_dots param, Bedrock default aux model
  • tests/agent/test_bedrock_adapter.py — 7 new tests (2 modality + 2 picker + 3 auxiliary)

Testing

137 tests passing on EC2 (Python 3.11.14).

Ref: #7920, #10549

… profiles\n\nInference profiles (us.*, global.*) were hardcoded to TEXT-only input/output\nmodalities. Claude profiles support IMAGE input but this was not reflected\nin discovery results, potentially causing vision features to be excluded.\n\nNow inherits modalities from the underlying foundation model via ARN\nlookup, matching OpenClaw resolveInferenceProfiles() pattern.\n\nRef: PR NousResearch#7920 feedback from @ptlally\n132 tests passing.
list_authenticated_providers() only checked API keys and auth stores,
missing Bedrock's aws_sdk auth type entirely. The /model command (no args)
would show 'No authenticated providers found' even with valid IAM
credentials (instance role, SSO, env vars).

Add has_aws_credentials() check in the CANONICAL_PROVIDERS loop so
Bedrock appears in the provider picker when AWS credentials are available.

2 new tests for detection/non-detection.

Ref: PR NousResearch#7920 colleague feedback
@JiaDe-Wu JiaDe-Wu changed the title fix(bedrock): inherit modalities from foundation models for inference profiles fix(bedrock): inherit modalities for inference profiles + detect AWS creds in /model picker Apr 17, 2026
Bedrock's aws_sdk auth type was not handled by resolve_provider_client(),
causing 'No auxiliary LLM provider configured' warning on startup. Context
compression would fall back to dropping middle turns without summaries.

Changes:
- auxiliary_client.py: Add aws_sdk auth branch using AnthropicBedrock SDK
- auxiliary_client.py: Add preserve_dots param to _AnthropicCompletionsAdapter
  and AnthropicAuxiliaryClient (Bedrock model IDs use dots as separators)
- auxiliary_client.py: Register bedrock default aux model (Claude Haiku 4.5)
- 3 new tests for resolution, preserve_dots, and graceful failure

Ref: PR NousResearch#7920 colleague feedback
@JiaDe-Wu

Copy link
Copy Markdown
Contributor Author

Added a third fix based on testing feedback from @sunl — Bedrock's aws_sdk auth type wasn't handled by resolve_provider_client() in auxiliary_client.py, so Bedrock users lost context compression (fell back to dropping middle turns without summaries). Now routes through AnthropicBedrock SDK with preserve_dots=True to keep model IDs intact.

Thanks @sunl for the thorough root cause analysis and the auxiliary client + preserve_dots findings 🙏

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists provider/bedrock AWS Bedrock (boto3, IAM) comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 25, 2026
@JiaDe-Wu

Copy link
Copy Markdown
Contributor Author

Closing in favor of a rebased, focused PR. Two of the three fixes here (the /model picker AWS credential detection and the auxiliary-client aws_sdk branch) have since landed on main via other contributors' PRs, so this branch now conflicts. The remaining unmerged fix — inheriting modalities from foundation models for inference profiles — has been rebased onto current main and split into its own clean PR. Re-opening as a fresh PR shortly.

@JiaDe-Wu JiaDe-Wu closed this May 29, 2026
@JiaDe-Wu

Copy link
Copy Markdown
Contributor Author

Replaced by #34359 (rebased onto current main, scoped down to just the inference-profile modality fix).

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

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists 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.

2 participants