Repository navigation
fix(cron): preserve operator continuations across edits and restarts - #180891
Conversation
Read the current stored continuation after its conversation becomes idle, and recapture authenticated owner authority on updates. Bind authority to executable inputs instead of scheduling metadata, retain compatible stored sources, and retire invalid sources after one failed attempt.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 420854d100
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } = job; | ||
| return resolveLegacyCronRequesterExecutionRevision({ | ||
| ...execution, | ||
| name: "Scheduled execution", |
There was a problem hiding this comment.
Include the job name in the execution revision
resolveCronRequesterExecutionRevision now replaces name with a constant even though buildCronCommandBody injects job.name directly into the model prompt as [cron:<id> <name>]. Consequently, a remote manageAll caller can rename an operator-backed job to contain new instructions without supplying fresh operator authentication; reconciliation considers the execution unchanged and preserves the stored operator source, so those instructions run with the previous operator authority. Keep this model-facing field in the revision or stop adding it to the prompt.
AGENTS.md reference: AGENTS.md:L66-L66
Useful? React with 👍 / 👎.
| operatorCapture = await captureCronCreatorSession( | ||
| nextJob, | ||
| creatorScope, | ||
| { client, context, signal }, | ||
| cfg, |
There was a problem hiding this comment.
Bind the operator capture to the locked job revision
The operator source is captured from the initially read nextJob before updateWithPrecondition acquires the mutation lock. If another manager changes the payload and clears its source during this await, the precondition later validates the newer locked job but still passes this stale capture; because reconcileCronOperatorSource unconditionally accepts any captured source, even a metadata-only first request reauthorizes the concurrent manager's payload with the owner's operator authority. Recapture from the locked job or reject when its revision differs from the job used for this capture.
AGENTS.md reference: AGENTS.md:L66-L66
Useful? React with 👍 / 👎.
| ((result.errorClassification?.kind === "permanent" && isPluginCommandCronJob(job)) || | ||
| (job.operatorSource && | ||
| /(?:Scheduled operator continuation definition changed|Scheduled operator source no longer owns this conversation|Cron occurrence source authority is no longer active|Restart recovery (?:authentication owner changed|operator (?:source policy changed|identity changed|authority (?:changed|is no longer active))))/.test( | ||
| result.error ?? "", | ||
| ))) |
There was a problem hiding this comment.
Classify every permanent operator-source rejection
The new terminal handling recognizes only a hand-maintained subset of restoration messages. Permanent failures such as Restart recovery operator source is invalid, Restart recovery operator source exceeds its storage bound, and Restart recovery operator profile is unavailable are thrown by the same restoration path but do not match this regex, so a recurring continuation is scheduled and retried instead of being disabled after its first unrecoverable authority failure. Use a structured permanent classification for operator restoration failures rather than matching selected error text.
Useful? React with 👍 / 👎.
|
Codex review: blocked before merge. What this changesPreserves authenticated scheduled continuations across owner edits and restarts, validates stored definitions independently of trigger context, and retires unusable sources. Example: A scheduled continuation receives trigger context containing "CI passed".
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain This PR addresses demonstrated continuation failures, but three defects still block merging: premature revision capture, inconsistent launch definitions, and broken compatibility with released paused jobs. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway automation handlers capture authenticated operator sources, the SQLite-backed cron mutation owner binds them to job definitions, and the run queue restores current authority before admitting scheduled conversation work. flowchart TD
A[Authenticated owner turn] --> B[Gateway cron handlers]
B --> C[Cron mutation owner]
C --> D[Stored job and source]
D --> E[Run queue and idle wait]
E --> F[Operator source restoration]
F --> G[Session admission]
G --> H[Guarded tool effects]
Technical reviewBest possible solution: Use the existing finalized mutation projection for capture, one admitted definition throughout launch, and an upgrade-safe conversion of released source revisions. Do we have a high-confidence way to reproduce the issue? Source tracing establishes all three failing paths, and the supplied harness reports reproduce the original continuation failures; no target code was executed during this review. Is this the best way to solve the issue? The existing owners are appropriate, but capture and launch must consume the same canonical definition, and compatibility must account for released paused sources. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2abd386a6dbc. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The launch mismatch breaks the binding between the executable payload and the operator source being validated. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +85, Tests +270, Docs +10. Total +365 across 18 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 (2 earlier review cycles)
Reviewed October 22, 2026, 9:29 PM ET / October 23, 2026, 01:29 UTC (Revision 3). |
Merge main and preserve exact requester revision semantics. Normalize only operator-source enablement, bind fresh captures to the locked definition, and classify pre-admission source failures as permanent. Keep current-definition admission after the creator finishes and validate the stored job independently of trigger-added context. Add guarded-effect regressions for manager edits, stale captures, runtime-disabled stored data, and malformed sources without a compatibility bridge or format change.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49d1bf3781
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| /** Runtime auto-disable writes enabled into job_json without rebinding the owner's source. */ | ||
| export function resolveCronOperatorExecutionRevision(job: CronStoredJob): string { | ||
| return resolveCronRequesterExecutionRevision({ ...job, enabled: true }); |
There was a problem hiding this comment.
Preserve legacy revisions for initially disabled jobs
For a continuation created before this commit with enabled: false, cron.add stored the revision from resolveCronRequesterExecutionRevision(job), which included that false value. After upgrading, this helper always hashes enabled: true, so force-running the still-paused job fails the exact restoration comparison as a changed definition and permanently retires it. Accept the legacy false-enabled revision during restoration or migrate it before applying the canonical revision.
AGENTS.md reference: AGENTS.md:L56-L56
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e37b366ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| const manual = options.source === "manual" || options.source === "event"; | ||
| const admittedJob = structuredClone(entry.job); | ||
| const admittedJob = structuredClone(continuationSession ? current : entry.job); |
There was a problem hiding this comment.
Use the admitted definition throughout launch
When an operator-backed event run waits on a busy session and its owner edits the job before the wait completes, this selects current only for admittedJob; the same launch still builds the event payload and active marker from the stale entry.job. The occurrence can therefore execute the old prompt while restoreCronOperatorSource validates the new current revision, and newly added message authority is omitted because the marker reflects the old tool cap. Use the admitted definition for all launch-time payload and authority inputs.
AGENTS.md reference: AGENTS.md:L66-L66
Useful? React with 👍 / 👎.
Resolve the mechanical overlap with a3909d8 while preserving its live self-removal guard and all continuation scenarios. Keep the operator restore admission boundary and retryable abort classification. Self-removal occurs after admission, so the admitted early return retains the current occurrence without reading the deleted job row; no captured-job fallback is needed. Validation: all 151 tests in the seven requested cron and Gateway files pass, including self-removal with subsequent role revocation and session replacement. pnpm tsgo, both requested cron/Gateway test typechecks, scoped oxlint, scoped format:check, and git diff --check pass. Existing coordinator and Codex reviews retained; this commit reconciles reviewed changes without expanding behavior.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd9a38be00
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| throw new CronOperatorSourceError(error instanceof Error ? error.message : String(error), { | ||
| cause: error, | ||
| }); |
There was a problem hiding this comment.
Keep transient restoration failures retryable
When prepareUserProfileIdentity or loadPairedDevicePairingStoreRecordReadOnly fails because of a temporary SQLite/worker error, this blanket wrapper turns that infrastructure failure into CronOperatorSourceError. Both run paths classify that type as permanent, and applyJobResult then disables a recurring operator continuation, so one transient read failure can retire an otherwise valid job instead of retrying it. Restrict the permanent classification to confirmed invalid or revoked source failures.
Useful? React with 👍 / 👎.
|
Merged via squash auto-merge.
|
…penclaw#180891) * fix(cron): preserve operator continuations across edits and restarts Read the current stored continuation after its conversation becomes idle, and recapture authenticated owner authority on updates. Bind authority to executable inputs instead of scheduling metadata, retain compatible stored sources, and retire invalid sources after one failed attempt. * fix(cron): keep aborted continuation restores retryable * test(cron): type the aborted restore fixture
…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)
What Problem This Solves
Fixes: scheduled operator continuations (the "finish this after CI" turns agents schedule while landing PRs) fail closed and silently stop the task when the owner refreshes a queued continuation, or when a recurring trigger fires with context.
User Impact
User impact: an agent that schedules a same-conversation continuation from an authenticated owner turn can refresh it while it waits, and a CI-watch trigger can hand back context, without the continuation losing the owner's authority. A continuation whose stored source is unusable now stops after one failure with its error kept, instead of retrying with backoff for hours. Non-owner edits still strip the owner's authority, and model-facing names and schedules stay part of the bound definition.
Why This Change Was Made
Two production incidents on a shared Gateway, both observed during PR landings:
cron.updatenever recapturedoperatorSource, so even an owner edit stripped the owner's own authority.{fire:true, message:"Continue the existing authorized PR… Exact-head CI signal: …"}.appendCronPayloadTextappends that message to the execution copy, and restoration hashed the copy instead of the stored definition. Every fire therefore failed with "Scheduled operator continuation definition changed" and retried with backoff. The journal shows 40 such failures in a week.The repair:
cron.updatecaptures the source through the same owner thatadduses. The capture is applied only if its definition revision matches the definition committed under the mutation lock, so a concurrent manager edit cannot borrow it.resolveCronRequesterExecutionRevisionis unchanged, so Discord/local requester and message-action consumers are untouched. Only the operator-source binding normalizesenabled, the one field the runtime row writer puts intojob_json. Every existing stored source was captured while enabled, so stored data validates without a migration or a fallback hash.CronOperatorSourceError, which both run callers classify as permanent, so the job retires after one failure. Aborts (restarts, cancellation) are rethrown unchanged and stay retryable.Accepted edges:
Evidence
src/cron/isolated-agent/run.operator-continuation.test.ts, 17 passed). Covered: queued owner payload edit, recurring trigger message across disable/re-enable, reschedule and restart, manager rename (no owner authority, no guarded effect), manager payload replacement racing an owner metadata capture,next_checkleaving the hash unchanged, a pre-upgrade row built with main's hash and runtime-disabled through the real row writer, and one terminal failure for definition mismatch, malformed source and oversized source.src/gateway/cron-operator-source.test.ts: an aborted restore stays retryable, while an unusable source is typed (red on the previous head, green now).main. The rename, concurrent-capture and malformed-source cases fail on the previous PR head420854d100a4.pnpm test <files> --maxWorkers=1.pnpm tsgo, cron and gateway test typechecks, changed-file oxlint and format checks, andgit diff --checkall passed.