Repository navigation
feat(cron): pause automations whose creating conversation is gone - #178965
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: needs maintainer review before merge. What this changesThis PR pauses parent-linked automations before execution when their creating conversation is removed, archived, or loses its worktree. Example: Nightly ingest is linked to agent:main:dashboard:parent, which is archived before its next occurrence.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for merge: the pause behavior is useful, both prior findings are resolved, and no introduced correctness defect remains; current-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCron admits stored automations using current parent-session facts, then either starts their executors or finalizes a skipped occurrence and dispatches its notification. flowchart TD
A[Stored automation] --> B[Occurrence admission]
C[Parent session facts] --> B
B --> D[Trigger and payload execution]
B --> E[Parent unavailable outcome]
E --> F[Disable automation]
F --> G[Owning agent notification]
Technical reviewBest possible solution: Keep parent pausing in occurrence admission and disablement plus owning-agent notification in the existing outcome owner. Do we have a high-confidence way to reproduce the issue? Current main admits occurrences without enforcing the parent-pause result, and the supplied Gateway run demonstrates the changed behavior; this read-only review executed no target code. Is this the best way to solve the issue? The change uses the existing shared admission, transactional outcome, and notification owners, providing the smallest complete pause path without another scheduler or persisted state model. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3cd9bddb36d9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +110, Tests +339, Other +186. Total +635 across 15 files. Added test files: 1. View PR surface stats
LabelsLabel 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 (3 earlier review cycles)
Reviewed October 22, 2026, 10:21 AM ET / 14:21 UTC (Revision 4). |
0944c7d to
3fa98ae
Compare
55fe6dc to
6f07b34
Compare
6c9f35b to
cd70797
Compare
3fa98ae to
178526d
Compare
cd70797 to
b965e40
Compare
|
Addressed the review of
@clawsweeper re-review |
985c8e1 to
b7990b0
Compare
|
🦞👀 Re-review progress:
|
b7990b0 to
06c3406
Compare
A job linked to the exact conversation that created it (sourceConversation or a stored operator source) is now paused by its occurrence admission when that conversation was removed or archived, or its bound worktree no longer exists. Nothing runs for that occurrence: no trigger script, payload or session turn. It is skipped with a notice that names the conversation and the re-enable command, and the job is disabled so it sends that notice once. It resumes only when re-enabled, and the next occurrence checks the parent again. A reset (/new) parent keeps the automation running: that occurrence is built as an unbound parent and takes the legacy decisions, with nothing carried into the new incarnation. Command jobs never pause: they still consume the admitted occurrence and run as before. Jobs without an exact parent link are unaffected, and a failed read never pauses.
06c3406 to
35ae687
Compare
Builds on #178933 and #179834 (both merged).
Related: #178812
Related: #178811
What Problem This Solves
Fixes: an automation keeps running after the conversation that created it has been removed or archived, acting on resources that conversation no longer has.
User Impact
User impact: an automation linked to the exact conversation that created it now pauses instead of running when that conversation is gone. "Gone" means the conversation was removed or archived, or its bound worktree no longer exists.
openclaw automations enable <id>command. The notice goes to the agent, not to the gone conversation.current,session:<key>,main, trigger and script jobs. An archived-parentsession:<key>job used to fail with an error in session admission. It now pauses with the notice.sessions.patchstill disables bound jobs, as it does today./new) does not pause. That occurrence runs as an unbound parent with the existing (legacy) decisions: run-session board, memory and workspace, no parent-only grants, and nothing carried into the new conversation. The replacement conversation's worktree is ignored.--session-key, and older jobs that store only a session key.Why This Change Was Made
pausewhen the parent is removed or archived, or a current parent's bound worktree is gone.executeJobCorechecks it right after admission, before any trigger or payload work. The separate pre-session check inrun-prepareand its second parent read are gone.unbound-parent. A failed read never pauses.parentUnavailablefact. Cron's outcome owner disables the job and queues one notice. A pause is not a failure, so it settles before generic skipped-run alerting: afailureAlertwithincludeSkippeddoesn't add a second notification. Both happen only when the outcome still owns the job's schedule (a newer operator edit wins) and the job was enabled before this outcome (one-shot jobs still get their notice).resolvePausedOccurrencelets them run. No creation-time stamp is added.autoDisabledenum is unchanged.Docs
docs/automation/cron-jobs/delivery.mddescribes the pause next to the auto-disable backstop, andtroubleshooting.mdexplains how to recognize a paused job.Evidence
src/cron/execution-context-admission.test.ts: removed and archived parents pause; a missing worktree pauses and names its path; a reset parent runs unbound, even when the replacement session's worktree is missing; a current parent; an unlinked job reads nothing; a failed read doesn't pause; the notice text.src/cron/service/timer-execution.occurrence.test.ts: across the full payload × target × trigger matrix, a paused occurrence starts no executor. Command jobs still run.src/cron/service/parent-pause.service.test.ts: through the real service and store, a forced run disables a recurring job without running it, and the notice is enqueued for the owning agent rather than the archived conversation. Re-enabling it pauses it again on the next run. A command job with a gone parent runs and stays enabled.src/cron/service/timer-outcomes.regression.test.ts: one notice, one notice when an alert route also reports skipped runs, the one-shot notice, and a stale outcome yielding to a newer operator edit.run.session-workspace-authority.test.ts: an archived-parentsession:<key>job is skipped with the notice, without reading files.QA scenario
qa/scenarios/scheduling/cron-archived-parent-pause.yaml, run withpnpm openclaw qa suite --scenario cron-archived-parent-pause --provider-mode mock-openaiagainst a real Gateway child: the run with a current parent reaches the model (1 job-prompt request at the mock provider), and after archiving, the forced run is skipped with the notice, the job is disabled, and the mock provider receives no further request for the job's prompt (1 → 1). Pass, 16 s. Inverting the final-effect assertion makes the scenario fail, so the check is live.test/scripts/cron-context-replay.test.ts: a changed lifecycle revision now replays as a readyunbound-parentoccurrence.Local, after the rebase onto main:
tsgo:core,tsgo:scripts,tsgo:test:src,tsgo:test:rootandtsgo:extensionsare clean; type-aware oxlint, oxfmt, the mock-exports and line-cap ratchets pass. Vitest over every changed test file plus the occurrence, admission, plugin-command, server-cron and replay suites: 301 of 301 pass.PR CI on
35ae687ffa2: every check passes (71 pass, 53 skipping).