Repository navigation
fix: auto-disable automations whose account was signed out - #207097
Conversation
A recurring automation whose recorded account was removed or signed out failed every occurrence and retried hourly forever. The refusal now carries a code from its producer; the configuration-refusal classifier marks it permanent on both run paths, including fallback summaries; and applyJobResult pauses the job once with one notice through the existing pause path. A fallback that finishes the run keeps it ok.
…pair Fable review: the retired authorization error also covers state lifecycle changes, so the producer stamps its code only when the profile itself is gone (new accountGone fact at the authorization owner) or the recorded authorization was replaced. Aborted and restart-interrupted runs never pause. The notice names the provider sign-in, edit, list and enable commands.
|
🦞👀 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: needs changes before merge. What this changesThis PR pauses automations after their recorded account disappears or is replaced and no fallback completes the run. Example: An hourly automation uses openai:primary, that account is removed, and its backup provider also fails.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it addresses a concrete retry loop, but its new account-gone classification misses supported personal accounts. Reviewed head: Before merge
Findings
Agent review detailsHow this fits togetherThe credential authorization owner reports account availability; cron carries that result through model fallback and applies scheduling state and notification intents. flowchart TD
A[Scheduled automation] --> B[Recorded account authorization]
B --> C[Model fallback chain]
C --> D[Cron refusal classifier]
D --> E[Scheduler outcome owner]
E --> F[Paused job]
E --> G[Repair notice]
Technical reviewBest possible solution: Complete the existing producer-to-classifier contract for deleted personal accounts while preserving successful fallback and temporary-store recovery. Do we have a high-confidence way to reproduce the issue? Current-main source leaves recurring retired-account failures on normal error backoff, and the PR reports a matching production incident; this read-only review did not execute a reproduction. Is this the best way to solve the issue? Reusing the credential producer, shared refusal classifier, and existing scheduler pause path is appropriately small, but every supported credential producer must supply the new fact. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1f0332980951. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +77, Tests +101, Docs +6. Total +184 across 14 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 27, 2026, 8:52 PM ET / November 28, 2026, 01:52 UTC. |
…over Local review: a fallback that failed for a reason that can pass must not pause the job. The run inference marks its refusal when a candidate on another provider runs; fallback summaries pause only when every attempt was the refusal. A forced run that preserves a one-shot occurrence never pauses, and the plugin/operator-source permanent-disable branch leaves this refusal to the pause path.
…navailable) D45: the job is auto-disabled on the first refusal that nothing else could recover from, with the existing auto-disabled notice, Doctor reason and recovery command, instead of reusing the parent-pause path. One new persisted reason value; stable v2026.11.10 loads, lists, shows and re-enables a store holding it (downgrade check). The CLI shows it as disabled (account); the sidebar keeps such jobs in its attention list.
Local review round 2: the one-shot branch disables a finished at-job before the outcome records why, so autoDisableCronJob no-oped and the job ended silently. The outcome now passes the enablement the run was admitted with.
|
Landed as 3d1f9df.
|
…t run (#207186) ## Problem Cron's fixed notices reach the owner conversation only as a session-event model turn. These are the auto-disabled notice (including `account-unavailable` from #207097) and the failure alert when no direct transport delivers it, which also covers repair fallbacks and the #207091 reset alert. The notice text becomes the turn's input row. When the conversation's own model cannot run, for example on the same signed-out account, the turn fails before it starts and writes no row. The user never sees why their automation stopped. ## Fix The Gateway cron adapter (`src/gateway/server-cron-targets.ts`) keeps the notice turn, because it is also the agent's repair turn (#188105). When a job notice's turn settles `failed` without starting and is not retained for retry, the adapter posts the same text through the existing session notice writer (`postSessionNotice`). This writes one transcript row, sends it to the conversation's channel unless the event is private, and adds the text to the next turn's context. No model turn is involved. - It uses the captured target's store path and `deliver` policy. - When the model works, nothing changes: the user sees the same row and the agent's reply. ## Review Fable reviewed this adversarially. Applied: drop the extra flag (`jobId` already identifies job notices); skip retryable outcomes, because the retained event still owns its text; honor the captured target's `deliver` and store path. Not applied: - A re-check of requester authority before the post. Authority is decided once, when the turn target is captured. Repo rules forbid `assertCurrent()`-style re-checks. - Always posting notices directly and hiding the repair input. That would change what users see when the model works, and would send a second channel message. Accepted edge cases: - A notice whose turn is `cancelled` by restart or supersession is not reposted. - A session that does not exist yet (`createIfMissing`) and fails before creation has nowhere to post. The warning is logged. ## Evidence - `src/gateway/server-cron-notice-delivery.test.ts` uses a real Gateway target resolver, a real session-event handoff and an owner model with no usable account. On the merge base, 0 visible notices. On this branch, exactly 1. - Cron failure-alert, delivery-outcome, startup-notification, Gateway notification and failure-repair final-effect suites pass. Co-authored-by: Ayaan Zaidi <[email protected]>
…207097) ## What Problem This Solves When the account an automation was recorded with is removed or signed out, every run of that automation fails. A recurring automation then fails again on every scheduled run, indefinitely: the refusal is classified as `unknown`, and nothing ends the loop. On one production deployment, 11 automations on one signed-out account failed 270 times in 2.8 days. 170 of those were `All models failed (4)`, because every configured fallback was on the same signed-out account. Six of them were still looping when measured. ## User Impact An automation whose recorded account was removed, signed out or replaced is now auto-disabled after the first run that nothing else could finish. It uses the existing auto-disable mechanism with a new reason, `account-unavailable`. The owner gets one notice that names the repair: 1. sign in again (`openclaw models auth login --provider <provider> --force`); 2. record the account (`openclaw automations edit <id> --model <provider/model>@<profileId>`, or a plain model to use a configured key); 3. run `openclaw automations enable <id>`. `openclaw automations list` shows the job as `disabled (account)`, and `openclaw doctor` lists the recorded reason. The notice does not name the account; run history keeps the full refusal. The job keeps running when: - a fallback on another provider finishes the run (the run stays `ok`); - a fallback failed for a reason that can pass, for example a 429 (normal retry schedule); - the account store was only briefly interrupted, for example by a state database lifecycle change. A forced manual run that preserves a scheduled one-shot occurrence leaves that occurrence alone. ## Why This Change Was Made The fix is at the owners that already exist: - **Producer.** `acquireCronInferenceAuthorization` gives its refusal a code when the recorded account is gone or was replaced. The original `AuthProfileAuthorizationError` stays as `cause`. The code is added only when the authorization owner reports that the profile itself is absent, retired or expired: a new `accountGone` fact on `AuthProfileAuthorizationError`. Other retirements keep their old behavior. - **Run inference.** It marks the refusal when a fallback candidate on another provider runs. From then on the recorded account was not the run's only way to execute. - **Classifier.** `resolveCronConfigurationRefusal` classifies the refusal on both run paths (isolated and session target), and only when nothing else could run the job: either a surfaced refusal that no other provider bypassed, or a fallback summary whose every attempt was that refusal. It never matches error text. - **Outcome.** `applyJobResult` calls the existing `autoDisableCronJob` once, with reason `account-unavailable` and the existing `auto-disabled` notification in place of the failure alert. Aborted and restart-interrupted runs never disable. The permanent-disable branch for plugin and operator-source jobs leaves this refusal to the auto-disable path. - **Readers.** The new value is added to the Gateway protocol's `autoDisabled.reason` union, the Doctor reader, the CLI status label, and the Control UI sidebar's shape check, so such a job stays in the attention list. **Downgrade check** (stable `v2026.11.10`, isolated state, host variables stripped). A store holding one job with `autoDisabled.reason: "account-unavailable"` and one ordinary job loads exactly like a control store holding `schedule-errors`: - the list shows all jobs, and the new job reads as `disabled (1x)` (control: `disabled (schedule)`); - `show` works for both jobs; - `enable` clears the reason and re-enables the job; - no load errors. Stable therefore tolerates the new value, and no tolerant reader has to ship first. Accepted edges: - A job whose fallbacks keep failing for their own reasons keeps retrying on its normal schedule. Those failures belong to their own classes, for example long provider rate-limit resets. - An account retired in the middle of a run disables at the next run. - Fallback chains that return an "exhausted" result instead of throwing are not classified (the production failures threw). - The `auto-disabled` notice is delivered as a session event turn, like the existing auto-disable notices. If the owner session's own model cannot run (for example on the same signed-out account), that turn fails, and the notice does not reach the transcript. The job is still disabled with its recorded reason, which the automation list and `openclaw doctor` show. ## Evidence - **Red on main, green here:** `src/cron/session-run.cross-provider-fallback.integration.test.ts` runs a recurring session-target automation whose recorded account was removed or replaced and which has no other model to run on. On the merge base, the job stays enabled after the failed run. On this branch, it is auto-disabled with `account-unavailable` and exactly one notice, and a second settled result sends nothing. The same file keeps the fallback-success cases `ok`, and keeps a job running when its fallback failed with a 429. - **Isolated path:** `isolated-agent.auth-profile-propagation.test.ts` asserts the permanent classification for a removed account on both the embedded and CLI routes. - **No over-trigger:** `timer-outcomes.regression.test.ts` keeps a job running when only the authorization owner changed. - **Real Gateway** (built dist, isolated state, no real credentials): an automation recorded on an API-key account; the account was then logged out, and two runs were forced. - Merge base: the job stays enabled with 2 consecutive errors and a next run scheduled, and the person gets no notice. - This branch: after the first failure the job is disabled, with no next run and `autoDisabled.reason = account-unavailable`. One notice lands in the agent's conversation as a system notice. - **Behavior suite** (real gpt-5.4-mini, 11 cases): 11/11 gating on this branch vs 10/11 on the merge base. The base miss is the subagent-spawn case, unrelated to cron. Co-authored-by: Ayaan Zaidi <[email protected]>
…t run (openclaw#207186) ## Problem Cron's fixed notices reach the owner conversation only as a session-event model turn. These are the auto-disabled notice (including `account-unavailable` from openclaw#207097) and the failure alert when no direct transport delivers it, which also covers repair fallbacks and the openclaw#207091 reset alert. The notice text becomes the turn's input row. When the conversation's own model cannot run, for example on the same signed-out account, the turn fails before it starts and writes no row. The user never sees why their automation stopped. ## Fix The Gateway cron adapter (`src/gateway/server-cron-targets.ts`) keeps the notice turn, because it is also the agent's repair turn (openclaw#188105). When a job notice's turn settles `failed` without starting and is not retained for retry, the adapter posts the same text through the existing session notice writer (`postSessionNotice`). This writes one transcript row, sends it to the conversation's channel unless the event is private, and adds the text to the next turn's context. No model turn is involved. - It uses the captured target's store path and `deliver` policy. - When the model works, nothing changes: the user sees the same row and the agent's reply. ## Review Fable reviewed this adversarially. Applied: drop the extra flag (`jobId` already identifies job notices); skip retryable outcomes, because the retained event still owns its text; honor the captured target's `deliver` and store path. Not applied: - A re-check of requester authority before the post. Authority is decided once, when the turn target is captured. Repo rules forbid `assertCurrent()`-style re-checks. - Always posting notices directly and hiding the repair input. That would change what users see when the model works, and would send a second channel message. Accepted edge cases: - A notice whose turn is `cancelled` by restart or supersession is not reposted. - A session that does not exist yet (`createIfMissing`) and fails before creation has nowhere to post. The warning is logged. ## Evidence - `src/gateway/server-cron-notice-delivery.test.ts` uses a real Gateway target resolver, a real session-event handoff and an owner model with no usable account. On the merge base, 0 visible notices. On this branch, exactly 1. - Cron failure-alert, delivery-outcome, startup-notification, Gateway notification and failure-repair final-effect suites pass. Co-authored-by: Ayaan Zaidi <[email protected]>
…t run (#207186) ## Problem Cron's fixed notices reach the owner conversation only as a session-event model turn. These are the auto-disabled notice (including `account-unavailable` from #207097) and the failure alert when no direct transport delivers it, which also covers repair fallbacks and the #207091 reset alert. The notice text becomes the turn's input row. When the conversation's own model cannot run, for example on the same signed-out account, the turn fails before it starts and writes no row. The user never sees why their automation stopped. ## Fix The Gateway cron adapter (`src/gateway/server-cron-targets.ts`) keeps the notice turn, because it is also the agent's repair turn (#188105). When a job notice's turn settles `failed` without starting and is not retained for retry, the adapter posts the same text through the existing session notice writer (`postSessionNotice`). This writes one transcript row, sends it to the conversation's channel unless the event is private, and adds the text to the next turn's context. No model turn is involved. - It uses the captured target's store path and `deliver` policy. - When the model works, nothing changes: the user sees the same row and the agent's reply. ## Review Fable reviewed this adversarially. Applied: drop the extra flag (`jobId` already identifies job notices); skip retryable outcomes, because the retained event still owns its text; honor the captured target's `deliver` and store path. Not applied: - A re-check of requester authority before the post. Authority is decided once, when the turn target is captured. Repo rules forbid `assertCurrent()`-style re-checks. - Always posting notices directly and hiding the repair input. That would change what users see when the model works, and would send a second channel message. Accepted edge cases: - A notice whose turn is `cancelled` by restart or supersession is not reposted. - A session that does not exist yet (`createIfMissing`) and fails before creation has nowhere to post. The warning is logged. ## Evidence - `src/gateway/server-cron-notice-delivery.test.ts` uses a real Gateway target resolver, a real session-event handoff and an owner model with no usable account. On the merge base, 0 visible notices. On this branch, exactly 1. - Cron failure-alert, delivery-outcome, startup-notification, Gateway notification and failure-repair final-effect suites pass. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 22a3aec) Release adaptation: Keep the beta.2 cron troubleshooting document; its release-specific surrounding guidance conflicts. The runtime/test patch applies unchanged. Companions: #207226 changes notice display to direct posting with hidden repair input; not needed for the failed-before-start fallback, and not in this lane. Co-authored-by: RomneyDa <[email protected]>
…t run (#207186) Cron's fixed notices reach the owner conversation only as a session-event model turn. These are the auto-disabled notice (including `account-unavailable` from #207097) and the failure alert when no direct transport delivers it, which also covers repair fallbacks and the #207091 reset alert. The notice text becomes the turn's input row. When the conversation's own model cannot run, for example on the same signed-out account, the turn fails before it starts and writes no row. The user never sees why their automation stopped. The Gateway cron adapter (`src/gateway/server-cron-targets.ts`) keeps the notice turn, because it is also the agent's repair turn (#188105). When a job notice's turn settles `failed` without starting and is not retained for retry, the adapter posts the same text through the existing session notice writer (`postSessionNotice`). This writes one transcript row, sends it to the conversation's channel unless the event is private, and adds the text to the next turn's context. No model turn is involved. - It uses the captured target's store path and `deliver` policy. - When the model works, nothing changes: the user sees the same row and the agent's reply. Fable reviewed this adversarially. Applied: drop the extra flag (`jobId` already identifies job notices); skip retryable outcomes, because the retained event still owns its text; honor the captured target's `deliver` and store path. Not applied: - A re-check of requester authority before the post. Authority is decided once, when the turn target is captured. Repo rules forbid `assertCurrent()`-style re-checks. - Always posting notices directly and hiding the repair input. That would change what users see when the model works, and would send a second channel message. Accepted edge cases: - A notice whose turn is `cancelled` by restart or supersession is not reposted. - A session that does not exist yet (`createIfMissing`) and fails before creation has nowhere to post. The warning is logged. - `src/gateway/server-cron-notice-delivery.test.ts` uses a real Gateway target resolver, a real session-event handoff and an owner model with no usable account. On the merge base, 0 visible notices. On this branch, exactly 1. - Cron failure-alert, delivery-outcome, startup-notification, Gateway notification and failure-repair final-effect suites pass. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 22a3aec) Release adaptation: use the already-captured original target and lifecycle revision for fallback; retain stable repair turns and exception handling. Follow-ups: do not import direct-post redesign; the stable fallback neither posts twice nor follows a replacement session. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
When the account an automation was recorded with is removed or signed out, every run of that automation fails. A recurring automation then fails again on every scheduled run, indefinitely: the refusal is classified as
unknown, and nothing ends the loop. On one production deployment, 11 automations on one signed-out account failed 270 times in 2.8 days. 170 of those wereAll models failed (4), because every configured fallback was on the same signed-out account. Six of them were still looping when measured.User Impact
An automation whose recorded account was removed, signed out or replaced is now auto-disabled after the first run that nothing else could finish. It uses the existing auto-disable mechanism with a new reason,
account-unavailable. The owner gets one notice that names the repair:openclaw models auth login --provider <provider> --force);openclaw automations edit <id> --model <provider/model>@<profileId>, or a plain model to use a configured key);openclaw automations enable <id>.openclaw automations listshows the job asdisabled (account), andopenclaw doctorlists the recorded reason. The notice does not name the account; run history keeps the full refusal.The job keeps running when:
ok);A forced manual run that preserves a scheduled one-shot occurrence leaves that occurrence alone.
Why This Change Was Made
The fix is at the owners that already exist:
acquireCronInferenceAuthorizationgives its refusal a code when the recorded account is gone or was replaced. The originalAuthProfileAuthorizationErrorstays ascause. The code is added only when the authorization owner reports that the profile itself is absent, retired or expired: a newaccountGonefact onAuthProfileAuthorizationError. Other retirements keep their old behavior.resolveCronConfigurationRefusalclassifies the refusal on both run paths (isolated and session target), and only when nothing else could run the job: either a surfaced refusal that no other provider bypassed, or a fallback summary whose every attempt was that refusal. It never matches error text.applyJobResultcalls the existingautoDisableCronJobonce, with reasonaccount-unavailableand the existingauto-disablednotification in place of the failure alert. Aborted and restart-interrupted runs never disable. The permanent-disable branch for plugin and operator-source jobs leaves this refusal to the auto-disable path.autoDisabled.reasonunion, the Doctor reader, the CLI status label, and the Control UI sidebar's shape check, so such a job stays in the attention list.Downgrade check (stable
v2026.11.10, isolated state, host variables stripped). A store holding one job withautoDisabled.reason: "account-unavailable"and one ordinary job loads exactly like a control store holdingschedule-errors:disabled (1x)(control:disabled (schedule));showworks for both jobs;enableclears the reason and re-enables the job;Stable therefore tolerates the new value, and no tolerant reader has to ship first.
Accepted edges:
auto-disablednotice is delivered as a session event turn, like the existing auto-disable notices. If the owner session's own model cannot run (for example on the same signed-out account), that turn fails, and the notice does not reach the transcript. The job is still disabled with its recorded reason, which the automation list andopenclaw doctorshow.Evidence
src/cron/session-run.cross-provider-fallback.integration.test.tsruns a recurring session-target automation whose recorded account was removed or replaced and which has no other model to run on. On the merge base, the job stays enabled after the failed run. On this branch, it is auto-disabled withaccount-unavailableand exactly one notice, and a second settled result sends nothing. The same file keeps the fallback-success casesok, and keeps a job running when its fallback failed with a 429.isolated-agent.auth-profile-propagation.test.tsasserts the permanent classification for a removed account on both the embedded and CLI routes.timer-outcomes.regression.test.tskeeps a job running when only the authorization owner changed.autoDisabled.reason = account-unavailable. One notice lands in the agent's conversation as a system notice.