Skip to content

fix: let unpinned automations use live inference accounts - #202833

Open
jalehman wants to merge 2 commits into
mainfrom
feat/cron-owner-authorized-accounts
Open

jalehman wants to merge 2 commits into
mainfrom
feat/cron-owner-authorized-accounts

Conversation

@jalehman

@jalehman jalehman commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #202699 (first, non-breaking cut)

What Problem This Solves

An automation created without a recorded inference account stops running after its session switches to a stored account, even though an interactive turn works. It fails with "Automation has no recorded inference account." The same refusal blocks stored-account fallbacks, scheduled CLI runs on native login, and creation on non-stored credential routes such as AWS SDK.

User Impact

Unbound automations use the account an interactive turn would select. Session-target jobs follow the session's current account choice, including an explicit switch, and fallbacks select credentials live. Existing recorded bindings, including automatically captured ones, stay authoritative. Explicit model@profile pins, replacement and revocation refusal, #207097's auto-disable for a signed-out recorded account, configured-key recovery of a dead binding, native-CLI credential isolation, schedules and run history are unchanged. Unbound jobs need no migration or manual adoption.

Why This Change Was Made

This removes the refusal instead of building another account-authorization layer around it, and reuses the existing live-selection planner and fallback chain. Removed with it:

Doctor's receipt-backed restoration of recorded accounts after a state upgrade is kept. Binding capture at creation and current target behavior are unchanged. This PR does not soften existing bindings or stop capturing them for new jobs; that would change a working path.

Main changes reconciled in this rebase:

Review follow-ups from the previous revision:

  • An unbound session-target turn now keeps the session's explicit account as the fallback runner's locked profile, the same as an interactive turn. Before, admission checked only the provider's normal order.
  • Creating a job whose selected profile is a configured AWS SDK profile keeps the job unbound instead of refusing it for lacking a stored secret.
  • Docs limit the interactive-parity wording to credential selection.

Evidence

Head 9a44264f962e, rebased on main 58f1d4143051. The Gateway proof below ran on 933f8b041d65. The follow-up commit 9a44264f only changes Gateway boot: it now runs Doctor's account repair only when a job has a recorded account and an applied upgrade receipt exists. Its consumer test src/state/state-upgrade.test.ts now asserts that boot leaves an unbound job unchanged and never starts the repair. That test, state-upgrade.large-agent-db.test.ts and test/docker-entrypoint.test.ts pass.

  • Real model via ClawRouter, isolated Gateway in a Studio Crabbox local-container. An unbound session job; the owner switches the session to stored account B.
    • Main 58f1d414: error, "Automation has no recorded inference account…", no provider request.
    • Fix: ok / succeeded. The automation turn ran on B (HTTP 200, 1024-token limit). The relay maps synthetic account aliases to one real ClawRouter key and sends upstream model gpt-4.1-mini. It logs aliases and statuses only, never credentials or headers.
    • The separate Activity recap utility call also used B and got HTTP 400 for its utility model through the relay. That call is not the automation turn, and the run still completed.
  • Upgrade from latest stable 2026.11.12. Jobs were created and run on stable. The fixed source build then took over the same state, and doctor --fix --non-interactive exited 0.
    • The cron_jobs.job_json rows were byte-identical before the upgrade, after it, and after the post-upgrade runs. That covers name, enabled, schedule, session target, payload, delivery and inferenceBinding, including authorizationId. The five jobs included a disabled cron-expression job with its own pin.
    • Run-history counts matched.
    • After the upgrade the default model moved to gpt-4o and the account order became b,a:
Job created on 2026.11.12 After upgrade + drift
Explicit model@openai:a ok, account A
Automatically captured account A ok, account A
Configured key ok, configured key
Unbound session job, session switched to B ok, account B

No inference-account startup warnings appeared, and doctor --lint reported no cron-inference-accounts finding.

@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL labels Nov 21, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR lets automations without recorded accounts select credentials live and removes the obsolete refusal, adoption, and diagnostic paths.

Example: An unbound session automation follows a conversation switched to stored account B.

  • Before: The run fails with “Automation has no recorded inference account” before contacting the provider.
  • After: The automation completes using account B while jobs with recorded bindings retain their accounts.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, coherent first-phase repair with live and upgrade evidence; the overall tier reflects partial coverage of the linked proposal.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The inline evidence exercises an isolated Gateway and real model through the changed account-selection path, showing refusal on main and successful account-B execution on the fix. The stable-release upgrade report checks saved job bytes, authorization IDs, history, and subsequent credential choices. The final boot-only adjustment has a corrected consumer test and reported focused passes. Inspected reminder screenshots show activation state rather than inference credentials and add no account-selection proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Scheduled work stops after a valid account switch even though an interactive turn in the same conversation succeeds.
Reason: The maintainer-approved first phase restores refused runs without changing recorded bindings; automatic-binding policy and account visibility remain outside this PR.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still refuses affected unbound runs, and this PR resolves the previous boot-test blocker without a new actionable finding.

Reviewed head: 9a44264f962e142bcd5e7db0f31252ded3551acf

Before merge

None.

Findings

None.

Agent review details

How this fits together

Cron admits an occurrence, prepares its agent or session selection, and passes credentials through the existing embedded or CLI runner to inference; Doctor separately restores eligible recorded authorizations after upgrades.

flowchart TD
  A[Scheduled occurrence] --> B[Occurrence admission]
  B --> C[Account selection]
  C --> D[Recorded binding]
  C --> E[Live credential planner]
  D --> F[Embedded or CLI runner]
  E --> F
  F --> G[Inference provider]
Loading

Technical review

Best possible solution:

Land the scoped refusal removal using the existing credential planners while preserving recorded bindings and receipt-backed restoration.

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

Current-main source establishes the refusal path, and the supplied paired Gateway results reproduce an unbound session job failing after an account switch; this read-only review ran no target code.

Is this the best way to solve the issue?

Removing the scheduled-only refusal at its shared callers addresses the cause, and retiring its adoption and warning machinery avoids a competing selection policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f3d7932f1eb1.

Provenance checked

  • Unrecorded-account refusal changes intended behavior with a stated reason (fix: automations switch accounts when interactive defaults change #172590: Prevent automations from silently changing inference identity or billing when defaults or credential ordering change.)
  • Recorded runtime and account continuity keeps the original intent (f31b33f: Keep scheduled execution on the runtime compatible with its captured account rather than a copied session override.)
  • Doctor adoption and startup diagnostics changes intended behavior with a stated reason (fix(doctor): name scheduled CLI jobs that need an explicit account #195905: Identify unbound jobs that would be refused and provide explicit account-adoption guidance.)
  • Recorded authorization restoration keeps the original intent (24cb734: Recover carried-over scheduled jobs whose account authorization identity moved during an upgrade.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit f31b33f adds src/cron/run-inference.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f31b33fdeee7; files: src/cron/run-inference.ts)
  • Ayaan Zaidi: Raw commit e8ff306 adds src/cron/run-inference.ts:125 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e8ff306f7413; files: src/cron/run-inference.ts)
  • Jason (Json): Raw commit d25a316 adds src/cron/inference-binding.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d25a316fc7c3; files: src/cron/inference-binding.ts)

PR surface

Source -835, Tests -1250, Docs -25, Other -4. Total -2114 across 49 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 28 67 902 -835
Tests 14 186 1436 -1250
Docs 6 35 60 -25
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 10 -4
Total 49 294 2408 -2114

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • merge-risk: 🚨 auth-provider: Previously refused unbound automations can now use live stored-account selection and fallbacks, an intentional credential-routing tradeoff accepted in the maintainer-authored direction.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-21T01:37:02.753Z sha e074ade :: blocked before merge. :: [P3] Limit interactive-parity wording to credential selection
  • reviewed 2026-11-29T22:36:54.760Z sha 933f8b0 :: needs changes before merge. :: [P2] Update the boot-upgrade test when removing automatic adoption

Reviewed November 29, 2026, 6:14 PM ET / 23:14 UTC (Revision 3).

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 9a44264f962e142bcd5e7db0f31252ded3551acf
  • Maintainer: @jalehman
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/session-override.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/embedded-agent-runner/run/auth-plan.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. labels Nov 28, 2026
daniel-lxs added a commit that referenced this pull request Nov 28, 2026
Use the account selection from #202833, including explicit session accounts.
Keep existing account captures, model aliases and upgrade-receipt recovery.
Remove the obsolete boot adoption of jobs without a saved account.
daniel-lxs added a commit that referenced this pull request Nov 28, 2026
…ling

Integrate #207275. Legacy system-event reminders retain their account adoption and explicit repair, and new reminders follow the chat. Apply #202833's live account selection to unbound agent turns and preserve recorded provider accounts.
@jalehman
jalehman force-pushed the feat/cron-owner-authorized-accounts branch from b777e9e to 933f8b0 Compare November 29, 2026 22:07
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 29, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 29, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 29, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 29, 2026

This branch has not been deployed

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

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-sensitive-changed size: XL 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.

1 participant