Repository navigation
fix(cron): keep automations bound across message edits - #199512
Conversation
Automations name their creating conversation by key. Message edits, branch switches and resets rotate the transcript id or lifecycle revision; in-session continuations, isolated announce results and child-run parent bindings now follow the conversation to its current transcript instead of refusing or silently dropping. Archive and deletion still pause the job visibly. The session generation lease no longer compares the transcript id for stored references; live-writer fences opt into exactTranscript. Dropped conversation deliveries now log a Gateway warning. Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 3c3bda07-5575-8aa3-80d0-79e4a53d9de6
|
🦞👀 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. |
Co-authored-by: obviyus <[email protected]>
|
Codex review: needs maintainer review before merge. What this changesThis PR keeps automations linked to their creating conversation across message edits, branch switches, and resets. Example: The transcript for agent:main:dashboard:edited changes from original-session to edited-session.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a current automation failure, resolves both prior findings, and has no remaining actionable patch defects identified. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron admission combines stored jobs, current conversation facts, and requester authority to run scheduled work and deliver results through the shared transcript owner. flowchart LR
A[Stored automation] --> B[Occurrence admission]
C[Current conversation] --> B
D[Requester authority] --> B
B --> E[Agent or plugin command]
E --> F[Delivery owner]
F --> G[Current transcript]
Technical reviewBest possible solution: Use the existing conversation, admission, authority, and transcript owners to resolve automation links by key while preserving exact identity checks for live writers. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes the stored-transcript mismatch after an edit; the author's real-Gateway reproduction was not independently executed during this read-only review. Is this the best way to solve the issue? The patch repairs identity resolution in the existing owners, updates affected consumers together, and preserves requester authorization without adding a competing state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a426bf146b1b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -52, Tests +53, Docs +2, Other +3. Total +6 across 59 files. Added test files: 1. 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. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 (1 earlier review cycle)
Reviewed November 15, 2026, 5:32 AM ET / 10:32 UTC (Revision 2). |
Adapt f3fd75a and 700e8f4 to the 11.4 generation lease architecture. Stored links follow edits/resets, while live writers retain exact transcript fences and current operator authority checks. Reject deleted sources before restoring retained scheduled authority. Approved upstream head: b56ead5. Reviewed 24-file adaptation; 153 focused tests plus 12 correction tests, scoped type/lint/format and docs checks. No newer PR scope adopted. Co-authored-by: obviyus <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: obviyus <[email protected]>
Turn admission, dispatch and persistence now use the parent's current session id, and the remaining generation-contract tests prove key-following behavior. Co-authored-by: obviyus <[email protected]>
|
Addressed the review of
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Drop the parent-reset retirement and its per-parent cap exemption. Since openclaw#199512 a scheduled plugin command follows its parent conversation by key to the current transcript, so a reset no longer ends its schedules. The disabled / removed plugin retirement stays.
Backport PR #199512 from head e078957 to the existing beta.4 line. Stored automation links follow the current conversation through message edits, branch switches and resets; archived or deleted chats still stop visibly. Keep exact transcript and lifecycle fences for live writers and current operator authority. Adapt the older generation and operator-source owners without importing newer batching or changing the shared restart recovery schema. Preserve existing stored source fields while interpreting automation links by key. Source commits: f3fd75a, 700e8f4, e078957. Five original-baseline regressions fail before the repair. Focused regressions, consumer tests, core/scripts types, lint and docs checks verify the adapted owners. Isolated real-model Gateway proof covers rewind, branch switch, reset and visible archive refusal. The unrelated cron handover fixture still has its preexisting requestHeartbeat type error; no ignore or production workaround was added. Co-authored-by: obviyus <[email protected]> Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e06e36cd47f52069c23639f22881176a1f33198a)
Preserve the #199512 conversation-key binding contract in the isolated source fixture while retaining exact generation checks for current-source delivery. The old expectation fails on Node and Bun; the corrected file passes all 15 cases, targeted types, lint, formatting, and independent review. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…0396) ## Problem Automations created from a chat stop, and recurring watchers are disabled, when that chat changes while the automation runs. - A running automation restores its creator's authority through `restoreGatewayOperatorSource`. Its session-identity subscriber revoked that authority on any identity mutation that named the chat's key: a message edit (`sessions.rewind`), a reset, a compaction successor or a key move. Before #200314, creating any unrelated chat for the same agent also matched (`undefined === undefined`, #200307). - A revoked condition or script ends as code `aborted`. `classifyCronScriptFailure` mapped `aborted` to `permanent`, and `applyJobResult` disables an `operatorSource` job on its first `permanent` error. One interrupted check therefore turned a recurring watcher off for good. #180891 intended the opposite: "Aborts (restarts, cancellation) are rethrown unchanged and stay retryable." - Failure-repair turns compared the restored target's transcript id with the source's. Since #199512, key-linked sources no longer record that id, so the comparison was always unequal and every repair turn was silently downgraded to a non-owner. Observed in production: a watcher was disabled twice in one day. Each time its condition aborted ~3.4 s in, ~0.1 s after another job started an isolated run (a new session). ## Fix - `restoreGatewayOperatorSource` revokes only when the target chat is deleted (`kind === "delete"` for the target key). Edits, branch switches, resets and compaction keep the chat's authority; device, token, role, profile and grant revocation still end it through their existing subscriptions. The target type drops `sessionId`; the cron callers stop passing it. - `classifyCronScriptFailure` maps `aborted` to `{ kind: "aborted" }`. The scheduler already treats that as an interrupted attempt: it does not count toward the failure streak and the next occurrence runs. Real script failures stay `permanent`. If the creator's authority was genuinely revoked, the next occurrence's source restore refuses it and that refusal still retires the job. - `captureCronJobTurnTarget` drops the transcript-id comparison and links the repair turn to its chat by key. Not changed here: sandboxed stream automations pin the exact transcript in `cron-stream-sandbox-authority.ts` (follow-up). Plugin session work (`service-session-work.ts`) shares the subscriber but keeps its own transcript/lifecycle check at each use. Production code: +13 / −20. ## User impact - Editing a message, switching branches, resetting a chat or compacting it no longer stops the automations it created. - A watcher whose condition is interrupted runs again at its next occurrence instead of being disabled. - Deleting the chat still stops its running automations. - Already-disabled jobs are not re-enabled; run `openclaw automations enable <id>`. ## Evidence - Regression tests, red on the merge base `b4fc0534`, green on this head: - `operator-run-recovery.test.ts`: key-linked authority stays current across an unrelated chat, a new transcript id and a reset, and is revoked when the chat is deleted (base: revoked at the edit). - `timer-outcomes.regression.test.ts`: a key-linked watcher whose condition ends `aborted` stays enabled and scheduled; `internal_error` still disables it (base: `aborted` disabled it). - Touched and consumer suites pass on this head (`ocx test`): operator recovery, operator cancellation, cron operator source, repair notifications, isolated operator continuation/child/bind-parent, trigger evaluation, failure alerts, failure text, server-cron, outcome regressions. `operator-run-cancellation.test.ts` now cleans up the sender's run session with the real delete (`run-continuation-cleanup.ts` deletes it) instead of a transcript-id replacement. - `config/session-identity-allowlist.txt` shrinks 6584 → 6580 pins: `cron-job-turn-target.ts` no longer compares an identity, and `operator-run-recovery.ts` drops two comparisons. - Real Gateway from source (`ocx src`, isolated state, `openai/gpt-5.6-luna`), base vs head. The agent creates a 30 s condition watcher (`sleep 20` in the condition) from its own chat; the harness waits until a condition is `running`, then mutates the owner chat: | Event while a condition is running | Base `b4fc0534` | Head | |---|---|---| | Message edit (`sessions.rewind` + resend) | condition `aborted`; watcher disabled after 1 evaluation | condition completes (×3) | | Reset (`sessions.reset`) | not reached (already disabled) | condition completes | | Another chat created | not reached | condition completes | | Final job state | `enabled=0`, `cron trigger evaluation failed (aborted)` | `enabled=1`, 0 errors, 6 evaluations | A second, unsynchronized base run reproduced the same disable at the first edit that landed during a condition (abort in the same second as the edit). Co-authored-by: Ayaan Zaidi <[email protected]>
…nclaw#200396) ## Problem Automations created from a chat stop, and recurring watchers are disabled, when that chat changes while the automation runs. - A running automation restores its creator's authority through `restoreGatewayOperatorSource`. Its session-identity subscriber revoked that authority on any identity mutation that named the chat's key: a message edit (`sessions.rewind`), a reset, a compaction successor or a key move. Before openclaw#200314, creating any unrelated chat for the same agent also matched (`undefined === undefined`, openclaw#200307). - A revoked condition or script ends as code `aborted`. `classifyCronScriptFailure` mapped `aborted` to `permanent`, and `applyJobResult` disables an `operatorSource` job on its first `permanent` error. One interrupted check therefore turned a recurring watcher off for good. openclaw#180891 intended the opposite: "Aborts (restarts, cancellation) are rethrown unchanged and stay retryable." - Failure-repair turns compared the restored target's transcript id with the source's. Since openclaw#199512, key-linked sources no longer record that id, so the comparison was always unequal and every repair turn was silently downgraded to a non-owner. Observed in production: a watcher was disabled twice in one day. Each time its condition aborted ~3.4 s in, ~0.1 s after another job started an isolated run (a new session). ## Fix - `restoreGatewayOperatorSource` revokes only when the target chat is deleted (`kind === "delete"` for the target key). Edits, branch switches, resets and compaction keep the chat's authority; device, token, role, profile and grant revocation still end it through their existing subscriptions. The target type drops `sessionId`; the cron callers stop passing it. - `classifyCronScriptFailure` maps `aborted` to `{ kind: "aborted" }`. The scheduler already treats that as an interrupted attempt: it does not count toward the failure streak and the next occurrence runs. Real script failures stay `permanent`. If the creator's authority was genuinely revoked, the next occurrence's source restore refuses it and that refusal still retires the job. - `captureCronJobTurnTarget` drops the transcript-id comparison and links the repair turn to its chat by key. Not changed here: sandboxed stream automations pin the exact transcript in `cron-stream-sandbox-authority.ts` (follow-up). Plugin session work (`service-session-work.ts`) shares the subscriber but keeps its own transcript/lifecycle check at each use. Production code: +13 / −20. ## User impact - Editing a message, switching branches, resetting a chat or compacting it no longer stops the automations it created. - A watcher whose condition is interrupted runs again at its next occurrence instead of being disabled. - Deleting the chat still stops its running automations. - Already-disabled jobs are not re-enabled; run `openclaw automations enable <id>`. ## Evidence - Regression tests, red on the merge base `a0d35bd4`, green on this head: - `operator-run-recovery.test.ts`: key-linked authority stays current across an unrelated chat, a new transcript id and a reset, and is revoked when the chat is deleted (base: revoked at the edit). - `timer-outcomes.regression.test.ts`: a key-linked watcher whose condition ends `aborted` stays enabled and scheduled; `internal_error` still disables it (base: `aborted` disabled it). - Touched and consumer suites pass on this head (`ocx test`): operator recovery, operator cancellation, cron operator source, repair notifications, isolated operator continuation/child/bind-parent, trigger evaluation, failure alerts, failure text, server-cron, outcome regressions. `operator-run-cancellation.test.ts` now cleans up the sender's run session with the real delete (`run-continuation-cleanup.ts` deletes it) instead of a transcript-id replacement. - `config/session-identity-allowlist.txt` shrinks 6584 → 6580 pins: `cron-job-turn-target.ts` no longer compares an identity, and `operator-run-recovery.ts` drops two comparisons. - Real Gateway from source (`ocx src`, isolated state, `openai/gpt-5.6-luna`), base vs head. The agent creates a 30 s condition watcher (`sleep 20` in the condition) from its own chat; the harness waits until a condition is `running`, then mutates the owner chat: | Event while a condition is running | Base `a0d35bd4` | Head | |---|---|---| | Message edit (`sessions.rewind` + resend) | condition `aborted`; watcher disabled after 1 evaluation | condition completes (×3) | | Reset (`sessions.reset`) | not reached (already disabled) | condition completes | | Another chat created | not reached | condition completes | | Final job state | `enabled=0`, `cron trigger evaluation failed (aborted)` | `enabled=1`, 0 errors, 6 evaluations | A second, unsynchronized base run reproduced the same disable at the first edit that landed during a condition (abort in the same second as the edit). Co-authored-by: Ayaan Zaidi <[email protected]>
…0396) Automations created from a chat stop, and recurring watchers are disabled, when that chat changes while the automation runs. - A running automation restores its creator's authority through `restoreGatewayOperatorSource`. Its session-identity subscriber revoked that authority on any identity mutation that named the chat's key: a message edit (`sessions.rewind`), a reset, a compaction successor or a key move. Before #200314, creating any unrelated chat for the same agent also matched (`undefined === undefined`, #200307). - A revoked condition or script ends as code `aborted`. `classifyCronScriptFailure` mapped `aborted` to `permanent`, and `applyJobResult` disables an `operatorSource` job on its first `permanent` error. One interrupted check therefore turned a recurring watcher off for good. #180891 intended the opposite: "Aborts (restarts, cancellation) are rethrown unchanged and stay retryable." - Failure-repair turns compared the restored target's transcript id with the source's. Since #199512, key-linked sources no longer record that id, so the comparison was always unequal and every repair turn was silently downgraded to a non-owner. Observed in production: a watcher was disabled twice in one day. Each time its condition aborted ~3.4 s in, ~0.1 s after another job started an isolated run (a new session). - `restoreGatewayOperatorSource` revokes only when the target chat is deleted (`kind === "delete"` for the target key). Edits, branch switches, resets and compaction keep the chat's authority; device, token, role, profile and grant revocation still end it through their existing subscriptions. The target type drops `sessionId`; the cron callers stop passing it. - `classifyCronScriptFailure` maps `aborted` to `{ kind: "aborted" }`. The scheduler already treats that as an interrupted attempt: it does not count toward the failure streak and the next occurrence runs. Real script failures stay `permanent`. If the creator's authority was genuinely revoked, the next occurrence's source restore refuses it and that refusal still retires the job. - `captureCronJobTurnTarget` drops the transcript-id comparison and links the repair turn to its chat by key. Not changed here: sandboxed stream automations pin the exact transcript in `cron-stream-sandbox-authority.ts` (follow-up). Plugin session work (`service-session-work.ts`) shares the subscriber but keeps its own transcript/lifecycle check at each use. Production code: +13 / −20. - Editing a message, switching branches, resetting a chat or compacting it no longer stops the automations it created. - A watcher whose condition is interrupted runs again at its next occurrence instead of being disabled. - Deleting the chat still stops its running automations. - Already-disabled jobs are not re-enabled; run `openclaw automations enable <id>`. - Regression tests, red on the merge base `b4fc0534`, green on this head: - `operator-run-recovery.test.ts`: key-linked authority stays current across an unrelated chat, a new transcript id and a reset, and is revoked when the chat is deleted (base: revoked at the edit). - `timer-outcomes.regression.test.ts`: a key-linked watcher whose condition ends `aborted` stays enabled and scheduled; `internal_error` still disables it (base: `aborted` disabled it). - Touched and consumer suites pass on this head (`ocx test`): operator recovery, operator cancellation, cron operator source, repair notifications, isolated operator continuation/child/bind-parent, trigger evaluation, failure alerts, failure text, server-cron, outcome regressions. `operator-run-cancellation.test.ts` now cleans up the sender's run session with the real delete (`run-continuation-cleanup.ts` deletes it) instead of a transcript-id replacement. - `config/session-identity-allowlist.txt` shrinks 6584 → 6580 pins: `cron-job-turn-target.ts` no longer compares an identity, and `operator-run-recovery.ts` drops two comparisons. - Real Gateway from source (`ocx src`, isolated state, `openai/gpt-5.6-luna`), base vs head. The agent creates a 30 s condition watcher (`sleep 20` in the condition) from its own chat; the harness waits until a condition is `running`, then mutates the owner chat: | Event while a condition is running | Base `b4fc0534` | Head | |---|---|---| | Message edit (`sessions.rewind` + resend) | condition `aborted`; watcher disabled after 1 evaluation | condition completes (×3) | | Reset (`sessions.reset`) | not reached (already disabled) | condition completes | | Another chat created | not reached | condition completes | | Final job state | `enabled=0`, `cron trigger evaluation failed (aborted)` | `enabled=1`, 0 errors, 6 evaluations | A second, unsynchronized base run reproduced the same disable at the first edit that landed during a condition (abort in the same second as the edit). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 346d231) Release adaptation: preserve retired session identity allowlist; apply deletion-only key guard to baseline subscriber and retain new regression. Co-authored-by: RomneyDa <[email protected]> Follow-up disposition: bounded pinned-main same-path audit recorded in the lane report; cross-lane changes remain parent-owned. (cherry picked from commit 75f490aee889734669c4d8d718e4cbec0934491f)
Adapt f3fd75a and 700e8f4 to the 11.4 generation lease architecture. Stored links follow edits/resets, while live writers retain exact transcript fences and current operator authority checks. Reject deleted sources before restoring retained scheduled authority. Approved upstream head: b56ead5. Reviewed 24-file adaptation; 153 focused tests plus 12 correction tests, scoped type/lint/format and docs checks. No newer PR scope adopted. Co-authored-by: obviyus <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> (cherry picked from commit c15040a) Release adaptation: Existing 11.6 key-following delivery and exact writer fences retained. Reject deleted authenticated sources before either shared-session enqueue or isolated session preparation; do not recreate the deleted conversation. Six focused current-owner cases pass; both new deletion regressions fail without their fixes. Initial wrong-owner adaptation failure and artifact-lock lint setup failure preserved. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit abbee9c54faf8bc8590b19c0fa07e71c392b9bef)
Problem
Editing a message or switching a branch in the Control UI gives the chat a new transcript ID (
sessionId) and keeps its lifecycle revision. Automations stored the creating chat'ssessionIdand compared it every time they used it. After an edit:session rebound for sessionKey. The run still reportedok, and the Gateway logged no warning.Daily, idle and manual resets rotate the lifecycle revision, so pinning the revision instead would end automations at every auto-reset.
Fix
sessionIdand revision are ignored when read. In-session runs, isolated results and child-run parent bindings follow the chat's current transcript through edits, branch switches and resets. Archiving or deleting the chat still pauses the job, with the existing notice.sessionIdby default. It follows the chat's current transcript, and compares the lifecycle revision only when the reference carries one. Live-writer fences opt intoexactTranscript.cron-operator-source.tsis removed.not-delivered, which the existing failure-alert owner handles.There is no schema change and no migration. Existing jobs with old stored IDs work as they are.
Lease caller audit (14)
execution-context-admission)delivery-generation)memory-audiencesession-event-target,session-event-handoffprepareCronRootSessionGeneration(cli-runner,run-orchestrator,attempt-transcript-lifecycle-prepare)session-restart-resume-custodycommands-forksubagent-control-session,subagent-controller-read,subagent-control-killEvidence
7b81788) and pass here, covering delivery after an edit or reset, the warning when a chat is deleted, child bindings after a parent edit or reset, the in-session continuation, and the lease following an edit. About 650 tests pass across the touched suites and their siblings. Typecheck, oxlint and oxfmt are clean.sessions.rewind, the RPC behind the Control UI edit button.ok/not-deliveredwith nothing in the chat and no warning.build --dtsand the packed-install smoke both pass.Production code: +207 / −265.
Supersedes #199510 (same change plus test-type fixes for callers of the removed fields).
Follow-ups
sessionIdstill breaks after an edit: reactions, GitHub publication status, deep-research view state, the knowledgeconversations/<sessionId>partition, and goal continuation.