Skip to content

fix: Bedrock ARN region routing, Copilot device-flow pacing, TUI input fixes - #109740

Merged
steipete merged 2 commits into
mainfrom
fix/channel-provider-quirks
Jul 17, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/channel-provider-quirks

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three plugin-level provider fixes plus a terminal-UI dependency refresh:

  • Bedrock: an application inference-profile ARN embeds its region; when it differs from AWS_REGION, requests were routed to the wrong region and failed. The region embedded in an ARN model id is now used (explicit option still wins). Unknown/guardrail stop reasons surfaced as an opaque "An unknown error occurred"; the raw stop reason (e.g. guardrail_intervened) is now carried into the error message, with the mapping exhaustive over the current SDK union.
  • GitHub Copilot device login: the token poller fired immediately, ignored the server-provided interval, and treated slow_down as a fixed one-shot +2s. Per RFC 8628 it now waits the initial interval before the first poll and increases the interval cumulatively (or adopts the server's value) on slow_down — fixing logins that hung or looped on rate-limited responses.
  • Terminal UI: bumps the TUI library to 0.80.9 (patch line; no API changes) for editor paste-marker state accounting, alt+symbol key decoding on legacy terminals, and ANSI-aware tab expansion. pnpm-lock.yaml and the root npm-shrinkwrap.json are regenerated in lockstep.
  • User-message rendering: pasted numbered lists and backslash escapes were mangled in the user-message pane because the renderer didn't forward the ordered-list-marker/backslash-escape preservation options the assistant pane already uses.

Why This Change Was Made

All three provider issues are user-reported-shaped failures at plugin boundaries (wrong-region Bedrock calls, stuck Copilot logins, unreadable Bedrock errors); the dependency bump carries small input-handling fixes users hit daily in the TUI.

User Impact

Bedrock inference-profile ARNs work across regions and failures are diagnosable; Copilot device login completes reliably under slow_down; TUI paste/keys/tab rendering artifacts fixed; user-message markdown matches assistant rendering.

Evidence

  • node scripts/run-vitest.mjs extensions/amazon-bedrock/stream.runtime.test.ts extensions/github-copilot/login.test.ts — 56 tests passing (new cases: ARN region precedence incl. GovCloud, stop-reason detail mapping, RFC 8628 pacing with scripted token endpoint and fake timers).
  • node scripts/run-vitest.mjs src/tui — 30 files, 689 tests passing on the bumped dependency; new user-message rendering regression test.
  • pnpm deps:shrinkwrap:check green (root + package shrinkwraps current); typecheck/lint lanes green on changed files; autoreview clean.
  • Bedrock/Copilot are unit/mock-proven only: no AWS credentials in this environment, and the device flow is interactive.

@steipete
steipete requested a review from a team as a code owner July 17, 2026 06:57
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • npm-shrinkwrap.json
  • package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: e82311fa8ad334214492a3abd07da0f43d4911f8
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@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: e82311fa8a

ℹ️ 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".

profile: options.profile,
};
const configuredRegion = getConfiguredBedrockRegion(options);
const requestRegion = options.region || getBedrockModelArnRegion(model.id) || configuredRegion;

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.

P1 Badge Prefer ARN region over injected fallback region

When the normal embedded-runner path applies the Amazon Bedrock wrapStreamFn, the wrapper derives a fallback region from model.baseUrl/config and injects it with Object.assign({}, options, region ? { region } : {}) (extensions/amazon-bedrock/register.sync.runtime.ts:583-609). For an application-inference-profile ARN whose embedded region differs from that provider/base URL region, this line treats the wrapper fallback as an explicit override and never reaches getBedrockModelArnRegion, so production calls still construct BedrockRuntimeClient for the wrong region even though the direct streamBedrock unit test passes.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 3:46 AM ET / 07:46 UTC.

Summary
The PR changes Bedrock request region and stop-reason handling, Copilot OAuth device polling, TUI markdown rendering, and upgrades @earendil-works/pi-tui from 0.80.3 to 0.80.9.

PR surface: Source +52, Tests +216, Config 0, Other 0. Total +268 across 11 files.

Reproducibility: yes. from source with high confidence: use an application inference-profile ARN whose region differs from the configured provider or base-URL region, then invoke it through the registered Bedrock wrapStreamFn; the injected fallback reaches the changed stream code as options.region.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: vector/embedding metadata: extensions/amazon-bedrock/stream.runtime.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Fix the Bedrock wrapper or shared region precedence and add a registered-provider regression test.

Risk before merge

  • [P2] The normal embedded Bedrock path can still send an application inference-profile ARN to the provider or base-URL fallback region, leaving the headline cross-region failure unresolved despite the direct stream tests passing.

Maintainer options:

  1. Decide the mitigation before merge
    Resolve Bedrock region precedence once at the provider wrapper or shared resolver as explicit call option, then ARN region, then configured/base-URL/environment fallback, and prove it through the registered wrapStreamFn path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Because this protected maintainer-labeled PR already has a precise unresolved P1 finding, the branch should be corrected at the Bedrock wrapper boundary and reviewed again.

Security
Cleared: No concrete security or supply-chain regression was found in the existing-package patch update or provider and TUI code changes.

Review findings

  • [P1] Prefer the ARN region over the wrapper fallback — extensions/amazon-bedrock/stream.runtime.ts:169
Review details

Best possible solution:

Resolve Bedrock region precedence once at the provider wrapper or shared resolver as explicit call option, then ARN region, then configured/base-URL/environment fallback, and prove it through the registered wrapStreamFn path.

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

Yes from source with high confidence: use an application inference-profile ARN whose region differs from the configured provider or base-URL region, then invoke it through the registered Bedrock wrapStreamFn; the injected fallback reaches the changed stream code as options.region.

Is this the best way to solve the issue?

No; changing only the stream client's precedence is too narrow because the provider wrapper has already collapsed fallback and explicit regions into the same option before that code runs.

Full review comments:

  • [P1] Prefer the ARN region over the wrapper fallback — extensions/amazon-bedrock/stream.runtime.ts:169
    The registered provider wrapper injects its config or base-URL fallback as options.region, so this new precedence treats that fallback as explicit and never reaches the ARN region. Resolve precedence in the wrapper or shared resolver and add a regression test through wrapStreamFn; the direct streamBedrock test cannot catch this production path.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P1: The PR targets a broken provider workflow affecting real users, but its central Bedrock routing fix still misses the normal production wrapper path.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository automation identifies the author as a trusted repository administrator and openclaw-secops actor, so the external-contributor real-proof gate does not apply; the reported tests remain useful supplemental evidence.

Label justifications:

  • P1: The PR targets a broken provider workflow affecting real users, but its central Bedrock routing fix still misses the normal production wrapper path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository automation identifies the author as a trusted repository administrator and openclaw-secops actor, so the external-contributor real-proof gate does not apply; the reported tests remain useful supplemental evidence.
Evidence reviewed

PR surface:

Source +52, Tests +216, Config 0, Other 0. Total +268 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 81 29 +52
Tests 3 223 7 +216
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 2 9 9 0
Total 11 314 46 +268

What I checked:

Likely related people:

  • wirjo: Authored the inference-profile discovery and region-injection change that established the affected Bedrock wrapper handoff. (role: introduced behavior; confidence: high; commits: 78fe96f2d4c7; files: extensions/amazon-bedrock/register.sync.runtime.ts)
  • vincentkoc: Shared authorship of the original region-injection work connects this contributor directly to the affected Bedrock provider boundary. (role: adjacent owner; confidence: high; commits: 78fe96f2d4c7; files: extensions/amazon-bedrock/register.sync.runtime.ts)
  • steipete: Recently changed and tested the same Bedrock wrapper for inference-profile option shaping, beyond authoring this PR. (role: recent area contributor; confidence: high; commits: 771846c5fa8b; files: 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.

@steipete
steipete merged commit e693d27 into main Jul 17, 2026
178 of 183 checks passed
@steipete
steipete deleted the fix/channel-provider-quirks branch July 17, 2026 08:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…t fixes (openclaw#109740)

* build(deps): bump terminal UI library to 0.80.9

* fix(plugins): Bedrock ARN region routing, stop-reason detail, and Copilot device-flow pacing
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…t fixes (openclaw#109740)

* build(deps): bump terminal UI library to 0.80.9

* fix(plugins): Bedrock ARN region routing, stop-reason detail, and Copilot device-flow pacing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies-changed PR changes dependency-related files extensions: amazon-bedrock extensions: github-copilot maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant