Skip to content

fix: auto-disable automations whose account was signed out - #207097

Merged
obviyus merged 6 commits into
mainfrom
fix/cron-signed-out-pause
Nov 28, 2026
Merged

obviyus merged 6 commits into
mainfrom
fix/cron-signed-out-pause

Conversation

@obviyus

@obviyus obviyus commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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.

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.
@clawsweeper

clawsweeper Bot commented Nov 28, 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 agents Agent runtime and tooling size: M labels Nov 28, 2026
@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: c4a979cbce5ebb332b51ce4cac587d5ed5a499d1
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/authorization-contract.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/authorization.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 P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: The automation remains enabled and continues failing with hourly backoff.
  • After: The automation pauses after the failed run and queues one notice explaining how to repair and enable it.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The owner-based implementation is useful and focused, but has an actionable coverage gap and lacks inspectable required runtime proof; stored binding and job-state representations remain unchanged.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Automations tied to removed accounts repeatedly fail without ending the retry loop or providing a terminal repair notice.
Reason: The reported recurring failures justify the focused repair, and maintainer authorship establishes direction; personal-account deletion remains uncovered.

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: 1ab933bfbc679ad22ebd742cc50a545b05b011db

Before merge

  • [P2] Propagate accountGone from the personal-account producer (P2) - An automation can bind a personal account, as the existing Gateway account-adoption tests demonstrate. For those profile IDs, captureAuthProfileAuthorization delegates to capturePersonalAuthProfileAuthorization before reaching either newly flagged shared-store branch. When the personal account record is deleted, personal-authorization.ts:68–69 throws AuthProfileAuthorizationError("retired") without accountGone. This new condition consequently leaves the cron refusal untagged, resolveCronConfigurationRefusal misses it, and a recurring job remains enabled in the same retry loop this PR intends to stop. Set the fact at the personal producer when its canonical account record is positively absent, preserving unflagged lifecycle retirements, and cover that path through cron.

Findings

  • [P2] [P2] Propagate accountGone from the personal-account producer — src/cron/inference-binding.runtime.ts:344-346
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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:

  • [P2] [P2] Propagate accountGone from the personal-account producer — src/cron/inference-binding.runtime.ts:344-346
    An automation can bind a personal account, as the existing Gateway account-adoption tests demonstrate. For those profile IDs, captureAuthProfileAuthorization delegates to capturePersonalAuthProfileAuthorization before reaching either newly flagged shared-store branch. When the personal account record is deleted, personal-authorization.ts:68–69 throws AuthProfileAuthorizationError("retired") without accountGone. This new condition consequently leaves the cron refusal untagged, resolveCronConfigurationRefusal misses it, and a recurring job remains enabled in the same retry loop this PR intends to stop. Set the fact at the personal producer when its canonical account record is positively absent, preserving unflagged lifecycle retirements, and cover that path through cron.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Recorded inference-account continuity keeps the original intent (d25a316: Keep scheduled jobs on their recorded account and billing identity across interactive account changes.)
  • Cross-provider fallback keeps the original intent (e8ff306: Refuse only the recorded provider while allowing configured providers to use their live account selection.)
  • Pause notifications keeps the original intent (71bbd18: Pause jobs whose creating conversation is unavailable and send one actionable notice.)
  • Recurring failure enablement changes intended behavior with a stated reason (8bdaed5: Keep ordinary failed automations running instead of silently disabling them; this PR explains a narrow exception for account bindings that require an explicit repair.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs src/agents/auth-profiles/personal-authorization.test.ts src/cron/session-run.cross-provider-fallback.integration.test.ts src/cron/service/timer-outcomes.regression.test.ts --maxWorkers=1
  • pnpm tsgo:core
  • git diff --check
  • Demonstrate the personal-account deletion regression failing before the repair and passing afterward.
  • Inspect a sanitized Gateway capture of the repaired personal-account pause and single-notice behavior.

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 480555a adds src/cron/configuration-refusal.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 480555a26f25; files: src/cron/configuration-refusal.ts)
  • Jason (Json): Raw commit d25a316 adds src/agents/auth-profiles/authorization.ts:191 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d25a316fc7c3; files: src/agents/auth-profiles/authorization.ts)
  • Peter Steinberger: Raw commit 7bce7a6 adds src/agents/auth-profiles/authorization.ts:212 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7bce7a61639a; files: src/agents/auth-profiles/authorization.ts)
  • Josh Lehman: Raw commit 71bbd18 adds src/cron/scheduled-occurrence.ts:64 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 71bbd18bb2a9; files: src/cron/scheduled-occurrence.ts)

PR surface

Source +77, Tests +101, Docs +6. Total +184 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 97 20 +77
Tests 3 223 122 +101
Docs 2 9 3 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 329 145 +184

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 merge-risk: 🚨 compatibility: Existing automations with retired account bindings now become disabled and require explicit repair and re-enablement; the maintainer-authored proposal deliberately accepts this behavior.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • merge-risk: 🚨 compatibility: Existing automations with retired account bindings now become disabled and require explicit repair and re-enablement; the maintainer-authored proposal deliberately accepts this behavior.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide inspectable evidence for the reported Gateway verification.

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 follows the weaker of proof and patch quality; ✨ 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.

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.
@obviyus obviyus changed the title fix: pause automations whose account was signed out fix: auto-disable automations whose account was signed out Nov 28, 2026
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.
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations size: L and removed size: M labels Nov 28, 2026
@obviyus
obviyus merged commit 3d1f9df into main Nov 28, 2026
139 checks passed
@obviyus
obviyus deleted the fix/cron-signed-out-pause branch November 28, 2026 02:49
@obviyus

obviyus commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 3d1f9df.

  • Bug: a recurring automation whose recorded account was removed, signed out or replaced failed on every scheduled run, indefinitely. The refusal was classified unknown, so nothing ended the loop.
  • Fix: the refusal now carries a code from its producer, set only when the account itself is gone or was replaced. When nothing else could run the job, it is auto-disabled once with reason account-unavailable and the existing auto-disabled notice, which names the sign-in, edit and enable commands. A fallback that finishes or may recover keeps the job running.
  • Proof: red on the merge base, green here, on the session-target and isolated paths. A real Gateway run: the job is disabled after the first failure with one notice; the merge base stays enabled with no notice. A downgrade check: stable v2026.11.10 loads, lists, shows and re-enables a store holding the new reason.

obviyus added a commit that referenced this pull request Nov 28, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 29, 2026
…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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: L 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