Repository navigation
fix(amazon-bedrock-mantle): dedupe the IAM token-failure diagnostic per region (#67288) - #81208
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 995ed29231
ℹ️ 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".
| // discovery entirely instead of running IAM token generation and emitting | ||
| // "Mantle IAM token generation unavailable" log lines on every request. | ||
| // Fixes #67288. | ||
| if (enabled !== true && !explicitBearerToken && !hasAwsSdkCreds(env)) { |
There was a problem hiding this comment.
Preserve implicit discovery for IAM chain credentials
The new gate returns early when resolveAwsSdkEnvVarName(env) is unset, which means implicit Mantle discovery is skipped unless specific AWS env markers are present. This regresses hosts that authenticate through the AWS default credential chain without those env vars (for example instance roles/IRSA/credential files with default profile), even though generateBearerTokenFromIam is explicitly designed to use that chain (extensions/amazon-bedrock-mantle/discovery.ts:107-110). In those environments, discovery used to succeed but now returns null unless users manually force discovery.enabled=true.
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 12:04 AM ET / 04:04 UTC. ClawSweeper reviewWhat this changesThe PR deduplicates repeated identical Amazon Bedrock Mantle IAM token-generation debug diagnostics per region while retaining every credential-chain attempt. Merge readinessKeep open: current main still emits the IAM failure diagnostic on every failed token attempt, while this bounded plugin-local repair suppresses only identical consecutive debug diagnostics and preserves retries. No actionable correctness or security finding was found. Priority: P2 Review scores
Verification
How this fits togetherAmazon Bedrock Mantle discovers models by obtaining an explicit or IAM-generated bearer token, then registering discovered models with provider routing. This change affects diagnostic output from failed IAM token attempts without changing discovery configuration or runtime authentication. flowchart LR
A[Model catalog refresh] --> B[IAM bearer-token attempt]
B --> C{Token generated?}
C -->|Yes| D[Cache token and clear failure state]
C -->|No| E[Compare regional failure detail]
E --> F[Emit new debug diagnostic]
F --> G[Return no implicit provider]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +22, Tests +219. Total +241 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Refresh the clean merge result and terminal exact-head checks against current main, then land this plugin-local diagnostic-state repair. Do we have a high-confidence way to reproduce the issue? Yes, from source: repeated cache-miss IAM failures on current main each reach the same debug log call, and the supplied exact-head terminal transcript shows the repaired behavior with the real provider chain. Is this the best way to solve the issue? Yes. Repairing diagnostic state at the token-generation owner avoids the rejected credential-env gate and preserves late-arriving default-chain credential sources. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2b003f186dd8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (18 earlier review cycles; latest 8 shown)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper PR egg: 🎁 locked until real behavior proof passes. Details
|
8517367 to
1bc3123
Compare
|
Bumping for activity. Rebased onto current |
1bc3123 to
f14afbe
Compare
f14afbe to
69dc81a
Compare
69dc81a to
46f9dce
Compare
46f9dce to
996ea5f
Compare
996ea5f to
35bd35c
Compare
|
@clawsweeper re-review Please run the exact-head review for The prior exact-review run was superseded by the PR-body edit that published the refreshed proof and completed as a no-op. The head and body are now stable. The previous P2 is repaired, its disabled-to-enabled regression passes, and the body contains the repeated sterile runtime transcript. |
2e80916 to
484a7f2
Compare
|
@clawsweeper re-review Please run the exact-head review for The signed two-commit series was rebased without patch changes onto The refreshed PR body is stable at this head. Focused discovery tests pass 36/36, exact-head format and lint checks pass, and two sterile runtime runs pass using the installed |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
484a7f2 to
a2d1b8f
Compare
|
@clawsweeper re-review Please run the exact-head review for The owner decision from the prior review is implemented: consecutive identical formatted IAM failures are deduped per region, a changed formatted failure cause emits immediately, debug-disabled failures do not consume the stored detail, and successful token generation clears it. The signed three-commit series is based on current The stable PR body now contains the refreshed exact-head transcript. Focused discovery tests pass 37/37, exact-head format and lint checks pass, and two sterile runtime runs prove identical-failure dedupe, changed-cause re-log, debug enablement, recovery reset, and continued real credential-chain retries. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9
Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9
Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9
a2d1b8f to
ab58df9
Compare
Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: clear-orchard-lantern-bc
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Merged via squash.
|
…er region (openclaw#67288) (openclaw#81208) * fix(amazon-bedrock-mantle): dedupe IAM failure logs Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9 * fix(amazon-bedrock-mantle): emit IAM diagnostic after debug enables Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9 * fix(amazon-bedrock-mantle): surface changed IAM failures Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: cobalt-brook-meadow-m9 * fix(amazon-bedrock-mantle): fence stale IAM failures Co-authored-by: Shubhankar Tripathy <[email protected]> Punchcard-Session: clear-orchard-lantern-bc --------- Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes #67288. On hosts with no usable AWS credentials (Raspberry Pi installs, default Docker images), the
amazon-bedrock-mantleplugin attempts IAM bearer-token generation on every implicit-discovery call and logs[bedrock-mantle-discovery] Mantle IAM token generation unavailableevery time it fails.Why This Change Was Made
The fix dedupes consecutive identical formatted failure diagnostics per region instead of gating the IAM chain:
generateBearerTokenFromIamkeeps running the AWS default credential chain on every call. Hosts that rely on late-arriving credentials such as instance roles, IRSA, SSO, or shared profiles still start working as soon as the chain succeeds.An earlier revision short-circuited discovery when no AWS environment credentials were present. That approach was removed because it broke credential sources that are not visible in environment variables. The current diff adds no credential gate and no config surface.
Operator-observability policy: consecutive identical failures stay quiet, while a changed formatted failure cause is visible once per transition. This removes steady-state log flooding without hiding a new credential failure reason.
User Impact
AWS_BEARER_TOKEN_BEDROCKanddiscovery.enabled: falsebehavior is unchanged.Evidence
Validated commit:
256d92386ad9433c660cc8f0466c89a765124426Exact-head sterile runtime proof
The proof ran in a fresh GWT at the exact PR head with an empty temporary
HOME, nonexistent AWS config/credentials files, no AWS credential environment variables, andAWS_EC2_METADATA_DISABLED=true.For real failure steps, the harness wrapped only to count invocations and delegated to the unmodified installed
@aws/bedrock-token-generatorprovider. The dependency's real default credential chain produced the shown failure. A deterministic changed failure is injected twice to prove that a changed formatted cause emits once and an identical repeat stays quiet. The one redacted deterministic token is an explicit recovery event used only to prove that success resets the stored detail; the following failure delegates to the real chain again.This proves:
us-east-1still perform three provider calls;Dependency contract
Direct inspection of installed
@aws/[email protected]confirmed:dist/runtimeConfig.jssuppliescredentials: fromNodeProviderChain(...)when no explicit credentials are provided;dist/token.jspasses that credentials provider to SmithySignatureV4, whose presign path resolves it;Automated proof
git diff --check origin/main...HEADpassed.oxfmt --checkand directoxlintpassed for both changed files.0ef19111929092718173f31b48090197e6bf9697; the first three retain the prior range-diff result, and the fourth adds the success-epoch race fence plus both completion-order regressions.Part of #67288.
Punchcard-Session: clear-orchard-lantern-bc