Repository navigation
fix(bedrock): scheduled automations are refused on AWS SDK credential-chain routes - #192576
yubingjiaocn wants to merge 14 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: blocked before merge. What this changesAdds a revocable AWS SDK marker account that Bedrock setup creates and Doctor adopts for unbound scheduled automations. Example: A Bedrock automation uses an EC2 instance role and has no recorded inference account.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR repairs a current Bedrock scheduling failure, and the earlier findings are resolved; maintainer security approval and an unexplained CI failure remain. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherBedrock setup and Doctor create a non-secret account record; Cron binds its lifetime, and the agent checks that authority before dispatching inference through the AWS SDK credential chain. flowchart LR
A[Setup or Doctor] --> B[Auth store marker account]
B --> C[Cron inference binding]
C --> D[Agent authority checks]
D --> E[Bedrock transport]
F[AWS credential chain] --> E
Technical reviewBest possible solution: Use the existing auth-store lifetime for the AWS SDK marker, with Doctor adoption and unchanged revocation checks. Do we have a high-confidence way to reproduce the issue? Current-main capture and Doctor paths reject AWS SDK sources without a stored account, and the contributor supplied a matching 2026.10.10 CLI failure; no target code was executed during this review. Is this the best way to solve the issue? The marker-account approach fits the existing authorization owner, preserves config-only interactive routing, and avoids a second identity or revocation mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42a23ab0744c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +426, Tests +472, Docs +42, Other +6. Total +946 across 28 files. Added test files: 3. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed November 4, 2026, 9:24 AM ET / 14:24 UTC (Revision 5). |
|
Thanks for the review. Short answer to the decision question first, then how the next revision addresses the findings. Decision: the binding should not retain an AWS principal. OpenClaw's existing authorization model never binds to a provider-side identity.
IAM decides what the host's credentials can do. OpenClaw only needs to decide whether the operator has authorized scheduled runs on this route, and keep that authorization revocable. What changes: the root cause of findings 1–2 is that this revision put the declaration in config
Live proof planned (same isolated-container setup on a real AWS account):
I'll request re-review once the revision and the logs are up. |
c39c9f6 to
2624733
Compare
|
Revised per the direction in my earlier reply: the authorization identity is now What replaced the config-only declaration
Per finding[P1] Preserve revocation across removal and recreation — the name hash is
[P1] Observe declaration revocation after authorization capture — there is no [P1] Preserve existing declarations at the migration profile ID — the config The occupying record is byte-identical after [high] Route identity does not establish current account authority — agreed, This matches how the other cloud routes already work. On AWS, IAM is the authorization system: if the host can obtain credentials from the default chain (instance role, Pod Identity, SSO), IAM has explicitly granted them, and IAM policy decides what they may call. That is the same trust GCP ADC ( Evidence (live, redacted)EC2 host with only an instance role; isolated gateway in a container on a fresh
Red-on-base is scenario 1's first half (base refuses the same job in the same A scan for @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
2624733 to
e4a22a3
Compare
The plugin registered no auth method, so a Bedrock host using the AWS default credential chain had no named account. Register an `aws-sdk` method that declares `auth.profiles.amazon-bedrock:aws-sdk` (mode only, no credential material) and migrate configs that already set `models.providers.amazon-bedrock.auth: "aws-sdk"` onto that declaration.
Scheduled agentTurn jobs on an `auth: "aws-sdk"` Bedrock route were refused with "Automation has no recorded inference account": the route has no stored credential, so binding capture found nothing to record. A config-declared `mode: "aws-sdk"` profile is now the account for that route — the authorization identifies the declaration, so it retires when config stops declaring it — and Doctor adopts it for legacy automations that have no binding. The runtime guard is unchanged: an undeclared route stays unbound and its runs stay refused.
The AWS SDK route's authorization identity now lives in an auth-store record (`amazon-bedrock:aws-sdk`) that holds only the non-secret `aws-sdk-credentials` marker, the shape `extensions/microsoft-foundry` already uses for Entra ID. The record's incarnation is what scheduled runs bind, so deleting or recreating it revokes an old binding through the existing store facts instead of a provider-specific hash. Drops the config-only `auth.profiles` declaration and its name hashing (`declared-authorization.ts`), restoring `authorization.ts` and the Bedrock config compatibility path to hashing only owner-issued incarnations. A legacy `mode: "aws-sdk"` declaration stays eligible when the store holds the marker, and `runNonInteractive` persists the same record interactive setup does.
A scheduled run on an AWS SDK route records the stored marker account, so its binding carries that record's incarnation. Signing the account out, or recreating it under the same id, refuses the old binding; a route with no stored account stays unbound and refused, as before.
Doctor creates the `<provider>:aws-sdk` marker record for installs that only set `models.providers.<provider>.auth: "aws-sdk"`, then adopts it for legacy unbound automations. An id already held by a different provider or credential type is preserved and reported as a conflict, never overwritten; a preview run reports the missing record instead of writing it.
Documents the stored marker record as the authorization identity for scheduled Bedrock runs, how Doctor creates or adopts it, what a conflicting id does, and that signing out revokes bound automations. Allocates the net test lines the account's regressions add.
…baseUrl The provider config type requires baseUrl, so the Bedrock fixtures in the new account tests have to carry one. The eligibility fixture now shares that route object instead of repeating it, which is why the test-line allocation drops.
The Doctor repair derived the record's owner from the default agent, which refuses an explicit multi-agent fleet whose default comes from the system agent. The account is a shared credential every agent's store inherits, so resolve the shared store's own owner the way the rest of the auth-profile code does. Regressions use the shipped fleet shape (explicit ownership, two agents, a system agent): creation lands in the shared store, an occupied id is left alone, and each agent's legacy Bedrock automation adopts the record while a job on another provider's configured key stays untouched.
Doctor records an account only on automations that have none, so rerunning doctor --fix cannot rebind one whose account was signed out. Name the refusals and the explicit automations edit --model <model>@<profileId> recovery instead.
The post-preparation owner check only ran for a captured OAuth authorization, so an api-key route (the AWS SDK account among them) could install a credential whose record was removed or replaced while provider preparation awaited. The run's own request guard still refused the dispatch, but the revoked credential reached the runtime first. A scheduled run's binding owns every auth mode, so check it there too. Mid-run owner failures also surfaced the shared owner's MCP wording; Cron now names the automation, its account and the recovery instead. Regressions: the controller rejects without installing the credential when the record is removed while preparation awaits, and a real isolated Cron run on an aws-sdk route refuses with zero transport calls.
The plugin test asserted the shape of the config patch against a mocked store. Assert what the setup owes a later run instead: the saved account is the one the host resolves for Bedrock, it holds a non-secret marker, no AWS material reaches the config, a pre-existing account keeps its credential, and discovery opts in only for a usable region. Also drop the stored-marker group from the auth-profile order suite, whose resolver is already covered by the Cron and Doctor regressions.
The runtime provider registration listed no auth methods, so non-interactive setup refused the choice its own manifest advertises: Installed plugin "Amazon Bedrock" did not expose auth choice "amazon-bedrock-aws-sdk". Declare the method on that registration too, which is where the setup choice resolver reads a plugin's methods from.
The preparation-race regression asserted the message first, so a run of it against the pre-fix source stopped at the wording and said nothing about the request. Assert the zero transport calls first: the pre-dispatch check already prevented the request there, and this change is what moves the refusal to the preparation boundary and names the retired account.
e4a22a3 to
4842a0e
Compare
|
@vincentkoc are you able to review? Automations are pretty unusable for users making use of aws-sdk without this PR. |
fix(bedrock): give the AWS SDK route an account scheduled runs can record
Fixes #192524.
What Problem This Solves
Fixes: every scheduled automation on an Amazon Bedrock route that authenticates
through the AWS SDK default credential chain fails with "Automation has no
recorded inference account", and its advice cannot be followed.
models.providers.amazon-bedrock.auth: "aws-sdk"resolves credentials from thehost chain (instance role, container role, SSO profile, env), so nothing owned
the route in the auth store and the plugin registered no auth method — there was
no account id to name in
openclaw automations edit <jobId> --model <model>@<profileId>. Creating a new automation on that route was refused for thesame reason ("Automation requires a stored inference account or a key in the
environment or provider config"). The route worked interactively and was
unusable on a schedule, with no way out from the CLI.
User Impact
User impact: Bedrock hosts that authenticate through the AWS SDK chain can run
scheduled automations again, and that authority is revocable like any other
account.
It stores no AWS credentials: it creates the account
amazon-bedrock:aws-sdkholding OpenClaw's non-secret
aws-sdk-credentialsmarker, sets the provider'sauth: "aws-sdk", and records the region when one is given. The choice isdeclared on the runtime provider registration too, which is where
non-interactive setup reads a plugin's auth methods from
(
openclaw onboard --auth-choice amazon-bedrock-aws-sdk).openclaw doctor --fixcreates that account on hosts already configured withauth: "aws-sdk"and adopts it for automations that have no recorded account,so existing installs are repaired without re-running setup.
openclaw models auth logout amazon-bedrock:aws-sdkrevokes it: boundautomations are refused ("was removed or signed out"), and recreating the same
id does not revive them ("was replaced") until the account is selected again
explicitly — Doctor does not silently re-adopt a retired binding. Removing the
record while a scheduled run is preparing its provider auth is refused too
("was removed or replaced during the run"), before the credential is installed
for the request.
openclaw doctor --fixonce.amazon-bedrock:aws-sdkis already taken by a different account, nothing isoverwritten; Doctor reports the conflict and asks you to sign that account out
or rename it.
Why This Change Was Made
An OpenClaw authorization is the lifetime of an OpenClaw-owned auth-store
record, not a provider-side identity:
auth-profiles/authorization.tsderivesauthorizationIdfrom opaque store incarnations. So the fix gives the AWS SDKroute a real store record instead of inventing a second notion of identity.
api_key/key: "aws-sdk-credentials", already in the core non-secret marker list, samepattern as
gcp-vertex-credentialsand the Entra dynamic marker). Credentialsare still resolved per request from the AWS chain; the record only says which
account OpenClaw owns.
re-selection all go through the existing scheduler contract —
assertCurrentand revalidate already fail closed on a removed or re-created incarnation.
Nothing hashes config, and no new authorization path was added.
captureCronInferenceBindingand Doctor's cron migration previously rejectedthe direct
aws-sdkroute as an ambient credential; they now record thatstored account when the planner takes it. The runtime guard in
embedded-agent-runner/run/auth-plan.tsis untouched: an AWS SDK route with nostored account still produces no binding and its scheduled runs are still
refused.
observes one for this route (no
sts:GetCallerIdentityis called, see System agent /openclawtool permanently blocked on ambient AWS credentials: no execution-owner fingerprint for EKS Pod Identity / IRSA / instance roles #141983),and pinning one would make the scheduler depend on IAM state it cannot
re-check.
post-preparation re-check in
embedded-agent-runner/run/auth-controller.tsonly ran for a captured OAuth authorization, so an api-key route could install
a credential whose record had just been removed (the run's own pre-dispatch
guard still refused the request); a scheduled run's binding owns every auth
mode, so it is re-observed there too, and Cron names the automation and its
account in the refusal. Doctor's account creation derived the store owner from
the default agent, which refuses an explicit multi-agent fleet; the record is a
shared credential, so it resolves the shared store's own owner.
Docs:
docs/providers/bedrock.mdgains a scheduled-run section; thecredential-semantics and gateway-auth pages describe the marker account and how
signing it out revokes bindings.
Evidence
Unit and integration coverage:
extensions/amazon-bedrock/aws-sdk-auth.test.ts,extensions/amazon-bedrock/lazy-import.test.ts,src/agents/auth-profiles/order.test.ts,src/agents/embedded-agent-runner/run/auth-controller.binding.test.ts,src/cron/inference-binding.aws-sdk-profile.test.ts,src/cron/inference-binding-executor.test.ts,src/cron/isolated-agent.auth-continuity.integration.test.ts,src/commands/doctor/cron/inference-binding-migration.test.ts,src/commands/doctor/shared/aws-sdk-auth-account.test.ts— all green, pluspnpm tsgo:core,tsgo:extensions,tsgo:extensions:test,tsgo:test:src,oxlint and format on the touched paths.
Live validation on an EC2 host with only an instance role: isolated gateway in a
container, fresh state dir, port 28789, no messaging channels, live Bedrock
global.anthropic.claude-sonnet-5-5inus-west-2. No IAM or STS call is madeby the change or by its validation.
doctor --fixon the patched tree"status": "ok", replyREADYmodels auth logout amazon-bedrock:aws-sdk --yes, then trigger the bound jobdoctor --fix; thenautomations edit --model …@amazon-bedrock:aws-sdkdoctor --fixleaves the retired binding untouched; after explicit re-selection the binding carries a newauthorizationIdand the run is"status": "ok",READY"status": "ok",READYopenclaw agent -m …on the same routeINTERACTIVEamazon-bedrock:aws-sdkpre-occupied by a different credential, thendoctor --fix[email protected]on the same state dir: explicit ownership, two agents + systemAgent, one Bedrock automation per agent plus one on a non-Bedrock apiKey provider, thendoctor --fixon this build"status": "ok"/READY; config keeps every authored setting (Doctor adds only its own defaults and run metadata)openclaw onboard --non-interactive --auth-choice amazon-bedrock-aws-sdkon clean stateauth: "aws-sdk"written, a new automation runs"status": "ok"/READYmodels.authLogoutat measured offsets into a scheduled run, Bedrock requests counted outside the product by a CONNECT-tunnel proxyThe stored record is the marker only, read straight out of the state database:
and the binding scenario 1 produces is
(
authRequirementis"api-key"becauseCronInferenceBindingadmits onlyapi-key | subscription; it records the requirement class, not a stored key.)Signing out rotates the account's authorization lifetime, which is what retires
the binding. A scan for
AKIA|ASIA|SecretAccessKey|SessionTokenacross everystate directory and evidence log matches nothing, and no IAM or STS call is made
anywhere in the change or its validation.
Known limits
awsProfile/roleArnare out of scope; the region is carried bythe plugin's
discovery.region, otherwise the chain's own environment applies.lexicographically first is used. Choosing among multiple AWS accounts is
[Feature]: Explicitly authorize cross-provider cron fallback accounts #192009.
automations edit --model <model>@<profileId>(or a fresh unbound job); Doctor only adopts accounts for automations that have
no binding at all.
commits in the last few tens of milliseconds before the request is written to
the socket does not cancel that one in-flight request (measured live: 8 of 24
raced attempts). Signing out stops every later run, and a whole-provider sign
out aborts runs that have not dispatched yet.