Skip to content

fix: keep Bedrock live smoke on Bedrock runtime#99607

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
brian-bell:fix/bedrock-live-smoke-harness-87876
Jul 6, 2026
Merged

fix: keep Bedrock live smoke on Bedrock runtime#99607
vincentkoc merged 4 commits into
openclaw:mainfrom
brian-bell:fix/bedrock-live-smoke-harness-87876

Conversation

@brian-bell

@brian-bell brian-bell commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Related: #87876

AI-assisted: yes

What Problem This Solves

Fixes an issue where maintainers running explicit Bedrock Gateway live smokes could select amazon-bedrock/... models but fail before exercising Bedrock Converse. Explicit fallback candidates were synthesized as OpenAI Responses models or written with an invalid temporary provider config, and duplicate source-module loading could hide the registered Bedrock API provider.

Why This Change Was Made

The live harness now keeps explicit Bedrock fallback candidates on bedrock-converse-stream, writes a valid AWS SDK Bedrock provider config for temporary live model files, derives the temporary Bedrock runtime region from configured provider endpoints, AWS env, or the selected AWS profile instead of pinning us-east-1, and shares LLM API provider registrations across duplicate module instances in the same process.

User Impact

Maintainers can use explicit Bedrock model refs in Gateway live smokes to validate the real Bedrock runtime path for their AWS profile/region setup instead of tripping over harness/setup failures. This PR is a test/live-smoke enabler and does not close #87876 by itself.

Evidence

  • node scripts/run-vitest.mjs packages/llm-runtime/src/api-registry.test.ts
  • node scripts/test-live.mjs -- src/gateway/gateway-models.profiles.live.test.ts -t "writes valid AWS SDK provider config|uses AWS_REGION|preserves configured Bedrock provider endpoints|uses configured Bedrock discovery regions|uses selected AWS profile region|strips AWS profile region inline comments|prefers AWS credentials profile regions|uses the Bedrock Converse API"
  • git diff --check
  • ~/.agents/skills/autoreview/scripts/autoreview --mode local --prompt "Review autofix for PR #99607, https://github.com/openclaw/openclaw/pull/99607#issuecomment-4878396209. ..." -> clean, no accepted/actionable findings.
  • Real Bedrock Gateway live smoke with AWS profile auth only, no exported static AWS credentials and no AWS_REGION/AWS_DEFAULT_REGION in the smoke process:
$ unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_REGION AWS_DEFAULT_REGION AWS_BEARER_TOKEN_BEDROCK
$ OPENCLAW_LIVE_USE_REAL_HOME=1 \
  OPENCLAW_LIVE_GATEWAY=1 \
  OPENCLAW_LIVE_GATEWAY_PROVIDERS=amazon-bedrock \
  OPENCLAW_LIVE_GATEWAY_MODELS=amazon-bedrock/global.anthropic.claude-sonnet-4-6 \
  OPENCLAW_LIVE_GATEWAY_MAX_MODELS=1 \
  OPENCLAW_LIVE_GATEWAY_SMOKE=1 \
  OPENCLAW_LIVE_GATEWAY_THINKING=off \
  AWS_PROFILE=<profile> AWS_SDK_LOAD_CONFIG=1 \
  node scripts/test-live.mjs --no-quiet -- src/gateway/gateway-models.profiles.live.test.ts -t "runs meaningful prompts across models with available keys"

[live] [all-models] wanted=1 total=133
[live] [all-models] candidates=1 skipped=0
[live] [all-models] selection=explicit
[gateway] auto-enabled plugins for this runtime without writing config:
- amazon-bedrock/global.anthropic.claude-sonnet-4-6 model configured, enabled automatically.
[gateway] agent model: amazon-bedrock/global.anthropic.claude-sonnet-4-6 (thinking=adaptive, fast=off)
[gateway] http server listening (11 plugins: acpx, amazon-bedrock, bonjour, browser, canvas, device-pair, file-transfer, memory-core, ollama, phone-control, talk-voice)
[live] [all-models] running 1 models (thinking=off)
[live] [all-models] 1/1 amazon-bedrock/global.anthropic.claude-sonnet-4-6: prompt
[agent] run <run-id> ended with stopReason=stop
[live] [all-models] 1/1 amazon-bedrock/global.anthropic.claude-sonnet-4-6: tool-read
[agent] run <run-id> ended with stopReason=stop
[live] [all-models] 1/1 amazon-bedrock/global.anthropic.claude-sonnet-4-6: done

 Test Files  1 passed (1)
      Tests  1 passed | 101 skipped (102)
   Duration  88.95s

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 9:59 AM ET / 13:59 UTC.

Summary
The branch updates the Gateway live-smoke Bedrock fallback model config and the default LLM API registry so explicit amazon-bedrock/... smokes stay on Bedrock Converse with AWS SDK auth/region handling across duplicate module imports.

PR surface: Source +21, Tests +578. Total +599 across 3 files.

Reproducibility: yes. by source inspection. Current main synthesizes explicit Bedrock fallback models as openai-responses and builds provider configs without Bedrock AWS SDK auth/runtime endpoint, while the PR body includes after-fix live Bedrock output.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • No repair job is needed; there are no blocking review findings and the remaining step is normal maintainer review plus required merge gates.

Security
Cleared: Cleared: the diff does not add dependencies, workflows, broad permissions, or new secret emission; AWS shared-file reads are limited to live test harness region discovery.

Review details

Best possible solution:

Land this focused harness/registry fix after normal required checks stay green, while keeping the separate Bedrock prompt-abort fallback work tracked in #99608.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection. Current main synthesizes explicit Bedrock fallback models as openai-responses and builds provider configs without Bedrock AWS SDK auth/runtime endpoint, while the PR body includes after-fix live Bedrock output.

Is this the best way to solve the issue?

Yes. The PR fixes the explicit fallback model, provider-config merge, and default registry boundaries that prevent the smoke from exercising Bedrock, while leaving the separate long-context runtime abort behavior to #99608.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a98a64649ec0.

Label changes

Label justifications:

  • P2: This is a normal-priority provider live-smoke harness bug with limited blast radius and focused source plus live-output proof.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Sufficient live output in the PR body shows an after-fix Gateway Bedrock smoke using AWS profile auth, reaching prompt and tool-read probes, and passing with private profile details redacted.
  • proof: sufficient: Contributor real behavior proof is sufficient. Sufficient live output in the PR body shows an after-fix Gateway Bedrock smoke using AWS profile auth, reaching prompt and tool-read probes, and passing with private profile details redacted.
Evidence reviewed

PR surface:

Source +21, Tests +578. Total +599 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 25 4 +21
Tests 2 591 13 +578
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 616 17 +599

What I checked:

  • Repository policy read: Root AGENTS.md and src/gateway/AGENTS.md were read fully; the gateway/provider routing, dependency-contract, and PR best-fix guidance shaped this review. (AGENTS.md:1, a98a64649ec0)
  • Current main still has the harness bug: Current main creates explicit live fallback models with api: "openai-responses", so an explicit amazon-bedrock/... model can be synthesized on the wrong runtime. (src/gateway/gateway-models.profiles.live.test.ts:1138, a98a64649ec0)
  • Current main writes incomplete fallback provider config: Current main builds fallback provider config from model.api and model.baseUrl without adding Bedrock AWS SDK auth or a Bedrock runtime endpoint for synthesized explicit candidates. (src/gateway/gateway-models.profiles.live.test.ts:2620, a98a64649ec0)
  • PR head keeps explicit Bedrock fallback on Bedrock Converse: PR head maps amazon-bedrock explicit fallback candidates to bedrock-converse-stream, resolves the Bedrock runtime URL from config/env/profile/default, and writes auth: "aws-sdk". (src/gateway/gateway-models.profiles.live.test.ts:1138, da325e09d584)
  • Latest PR head covers configured stale runtime overrides: The latest commit adds a regression test and merge rule so an existing Bedrock provider entry with OpenAI-style api/auth keeps its base URL but gets the discovered Bedrock runtime api/auth. (src/gateway/gateway-models.profiles.live.test.ts:1876, da325e09d584)
  • PR head shares default API registry across duplicate module imports: The default runtime now stores the process-default registry/runtime behind Symbol.for, and the added test imports a duplicate module instance and verifies both imports use the same provider registration. (packages/ai/src/internal/default-runtime.ts:13, da325e09d584)

Likely related people:

  • vincentkoc: Recent commits touched the live Gateway profile smoke path and the live release-smoke selection area, and this PR is currently assigned to vincentkoc. (role: recent gateway live-smoke area contributor and likely follow-up owner; confidence: high; commits: e085fa1a3ffd, d92ba4f8aa38; files: src/gateway/gateway-models.profiles.live.test.ts)
  • steipete: History shows repeated work on Gateway live model tests, provider seams, and the Bedrock plugin runtime/discovery paths that define the invariant this PR mirrors. (role: LLM runtime and provider seam history owner; confidence: high; commits: 4ca07559abe4, 094140bdb11f, b39a7e807378; files: src/gateway/gateway-models.profiles.live.test.ts, packages/ai/src/internal/default-runtime.ts, extensions/amazon-bedrock/register.sync.runtime.ts)
  • wirjo: Prior merged Bedrock work added AWS SDK API-key injection and inference profile discovery/region injection, adjacent to the Bedrock runtime and region contract reviewed here. (role: Bedrock provider contributor; confidence: medium; commits: 019a25e35caa, 78fe96f2d4c7; files: extensions/amazon-bedrock/discovery.ts, extensions/amazon-bedrock/register.sync.runtime.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-03T18:56:26.557Z sha bf1f796 :: needs maintainer review before merge. :: none

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4889bf51fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/gateway-models.profiles.live.test.ts Outdated
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 3, 2026
@brian-bell

Copy link
Copy Markdown
Contributor Author

Added the requested real Bedrock Gateway live-smoke proof to the PR Evidence section.

The new run used AWS profile auth only (AWS_PROFILE, no exported static AWS key/session-token env vars) and shows the explicit amazon-bedrock/global.anthropic.claude-sonnet-4-6 Gateway smoke reaching the Bedrock runtime, completing prompt and tool-read probes, and passing.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 3, 2026
@brian-bell

Copy link
Copy Markdown
Contributor Author

Addressed the remaining item from #99607 (comment) in 9a52f9d.

What changed:

  • Explicit Bedrock fallback config no longer pins us-east-1 when AWS region/profile data is available.
  • Configured Bedrock provider endpoints are preserved.
  • Fallback region now resolves from AWS_REGION, AWS_DEFAULT_REGION, then selected AWS_PROFILE shared AWS config before the final us-east-1 fallback.
  • AWS profile parsing now matches the inspected Smithy region-file behavior for the covered cases: line comments stripped before parsing, quoted config profile sections accepted, and credentials-file region preferred over config-file region.

Proof:

  • node scripts/test-live.mjs -- src/gateway/gateway-models.profiles.live.test.ts -t "writes valid AWS SDK provider config|uses AWS_REGION|preserves configured Bedrock provider endpoints|uses selected AWS profile region|strips AWS profile region inline comments|prefers AWS credentials profile regions|uses the Bedrock Converse API"
  • node scripts/run-vitest.mjs packages/llm-runtime/src/api-registry.test.ts
  • git diff --check
  • profile-only real Bedrock Gateway smoke passed with no static AWS credential env and no AWS_REGION/AWS_DEFAULT_REGION in the smoke process.
  • ~/.agents/skills/autoreview/scripts/autoreview --mode local ... clean, no accepted/actionable findings.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a52f9d468

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/gateway-models.profiles.live.test.ts Outdated
@brian-bell

Copy link
Copy Markdown
Contributor Author

Addressed the Bedrock discovery-region review thread in bf1f796.

Focused proof added and passing:

  • node scripts/test-live.mjs -- src/gateway/gateway-models.profiles.live.test.ts -t "writes valid AWS SDK provider config|uses AWS_REGION|preserves configured Bedrock provider endpoints|uses configured Bedrock discovery regions|uses selected AWS profile region|strips AWS profile region inline comments|prefers AWS credentials profile regions|uses the Bedrock Converse API"
  • node scripts/run-vitest.mjs packages/llm-runtime/src/api-registry.test.ts
  • git diff --check
  • autoreview clean.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 3, 2026
@vincentkoc
vincentkoc force-pushed the fix/bedrock-live-smoke-harness-87876 branch from bf1f796 to ca14d31 Compare July 6, 2026 13:32
@vincentkoc
vincentkoc force-pushed the fix/bedrock-live-smoke-harness-87876 branch from 31bce01 to da325e0 Compare July 6, 2026 13:45
@vincentkoc vincentkoc self-assigned this Jul 6, 2026
@vincentkoc
vincentkoc merged commit bacb33a into openclaw:main Jul 6, 2026
96 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
* fix: preserve Bedrock live API providers

* fix: derive Bedrock smoke region from AWS config

* fix: honor Bedrock discovery region in smoke

* fix: keep Bedrock live smoke on Bedrock runtime

---------

Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* fix: preserve Bedrock live API providers

* fix: derive Bedrock smoke region from AWS config

* fix: honor Bedrock discovery region in smoke

* fix: keep Bedrock live smoke on Bedrock runtime

---------

Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Bedrock Converse Streaming silently aborts on long-context agent sessions (~6 min timeout, no retry, no fallback)

2 participants