Repository navigation
fix(cron): keep a started cron turn running when its job is edited - #207947
Merged
Merged
Conversation
Admission decides a cron turn's authority once at start. The session event target also re-compared the job's operator source (or scheduled requester) on every fence check, so cron.update mid-run killed the turn with "Automation operator source changed" (scope_authority_refused). Drop that re-check; the edit applies from the next occurrence.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Collaborator
Author
|
Landed as 7895017.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 29, 2026
…penclaw#207947) ## Problem A started cron turn died when someone edited its job. Daily refusal watch, 2026-11-28: ``` [gateway] cron: job updated [agent/embedded] session target preparation refused reason=scope_authority_refused lane task error: lane=cron-nested durationMs=36667 error="Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed" ``` `captureCronJobTurnTarget` (`src/gateway/cron-job-turn-target.ts`) gave the session event target an `assertCurrent` that re-read the job on every fence check. It compared the stored `operatorSource` (or the scheduled requester) with the value captured at start. `cron.update` changes that value, so the next fence check threw. The run's `assertScopeCurrent` turned it into `scope_authority_refused`. The cron notice and failure-repair turns use this target. A repair turn that fixes its own job killed itself. Root `AGENTS.md` "Decide authority once" does not allow this: authority is checked once, when work starts. The only stop after start is a permission writer stopping a named person's work. Editing a job is neither. This is the same class as R7 `source_authority_refused` (removed in openclaw#205268). ## Change - Remove both job re-reads from `captureCronJobTurnTarget`: the operator-source comparison ("Automation operator source changed") and the scheduled-requester comparison ("Automation requester changed."). - The edited source applies from the next occurrence. Admission at that start decides it. - Kept: admission at start, data fences (attempt lifecycle, session identity, target fields), the run abort signal, and the cron remove/disable cancellation (active-job marker → run `AbortController`). - `scope_authority_refused` stays. The run-registry binding (`source-closed`) still produces it. `scripts/lib/no-operator-permission-read.mjs` lists no removed site. ## What the user sees A cron notice or repair turn finishes after the job is edited. Before, it failed with "This agent run is no longer active. Start a new turn to retry." ## Evidence - New test `keeps a started cron turn running when its job is edited` (`src/gateway/operator-run-recovery.effects.test.ts`). It uses the real `CronService`, `captureCronJobTurnTarget` and `prepareSessionEventTargetForHost`, then edits the stored job's `operatorSource`. - Base `9e839f97`: red, `Error: Automation operator source changed`. - Head: green. - `ocx test` on the four test files that import `cron-job-turn-target.ts`: 35/35 pass. - `pnpm check:changed`: typecheck, lint, format and guards pass. The dead-export scan fails on base-only entries (`AgentCommandPluginIngressOpts`, `clearNativeRepositorySourceModulesForTest`, `resolveUpdateInstallSurfaceMock`). None of them are in this diff. - Live Gateway E2E (isolated Gateway, real `openai/gpt-5.5`, scratch state). Steps: the agent creates a cron job from chat with a 3 s timeout. `cron.run` fails, and the failure-repair turn starts in the owner session. The repair turn calls the cron tool to set `timeoutSeconds: 120` (`cron.update`), then runs one more `exec` and replies. - Base `9e839f97`: the job edit lands, then the repair turn ends `state: error` with `Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed`. The Gateway log has `scope_authority_refused`. This is the incident. - Head `4d50bb57`: the job edit lands and the repair turn ends `state: final`. The log has no `scope_authority_refused`. - One-admission E2E Q/R/S on head `4d50bb57`: all PASS. Revoking access while work is queued refuses it visibly, revoking access while a turn runs stops it (`access-reduced`), and Stop cancels the turn. Production: −18/+6 lines. Test: +56/−1. Co-authored-by: Ayaan Zaidi <[email protected]>
vincentkoc
added a commit
that referenced
this pull request
Nov 29, 2026
* commit '99b4afc696081eda8aefd8e91250c112f53a8a73': (564 commits) test(ios): verify send-at-tap feedback and work grouping (#207913) test(agents): reject unsuccessful live replay completions (#207724) fix(cron): keep a started cron turn running when its job is edited (#207947) improve(ui): put waiting for a free agent under automation timing (#201282) chore(ui): refresh control ui locales (#207514) fix: distinguish unresolved delivery failures from delivery history (#207897) test(doctor): require security check in proxy ordering assertion (#207912) fix: keep update rollback tests in sync with shipped workers (#207822) test(agents): fix provider header filtering coverage (#207732) refactor: remove the bundled GBrain adapter (#207924) improve(ui): show optional run limits beside the automation schedule (#201283) test(onboarding): inspect recorded output for credential leaks (#207872) perf(exec): reduce host memory sampler allocations (#207927) test(mcp-relay): isolate the Connected apps fallback locale (#207923) fix(acp): deliver bound channel replies to the pending question (#207035) fix(cron): keep required reports from going silent when nothing changes (#207044) test(sessions): assert participant queue rollback state (#207891) perf(gateway): skip session display preparation for transcript recall (#207916) test(agents): verify complete bracketed paste payload (#207733) test: stop timing out the cron recovery settlement test on slow runners (#207920) ...
vincentkoc
added a commit
that referenced
this pull request
Nov 29, 2026
* commit '1b246c09b0c1d41ed0f090f07fc50381decba90d': (574 commits) fix: stop the manual handoff UI test from hanging after completion (#207945) fix: surface favorites and recommended models in picker search (#201450) fix: show the saved quota reset when chat skips its only model (#207210) fix: avoid reloading unchanged plugins after Gateway boot (#207949) fix: keep Task progress double-clicks from changing the window (#207937) fix(doctor): continue repairs past retained conflicting exec approvals (#207951) test(reply): make account isolation assertion decisive (#207793) fix: keep task progress compact when reopening Details (#207943) fix(ui): restore the saved reading position after an empty search (#207673) fix: remove four Memory Wiki settings that had no effect (#207882) test(ios): verify send-at-tap feedback and work grouping (#207913) test(agents): reject unsuccessful live replay completions (#207724) fix(cron): keep a started cron turn running when its job is edited (#207947) improve(ui): put waiting for a free agent under automation timing (#201282) chore(ui): refresh control ui locales (#207514) fix: distinguish unresolved delivery failures from delivery history (#207897) test(doctor): require security check in proxy ordering assertion (#207912) fix: keep update rollback tests in sync with shipped workers (#207822) test(agents): fix provider header filtering coverage (#207732) refactor: remove the bundled GBrain adapter (#207924) ...
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 29, 2026
…207947) ## Problem A started cron turn died when someone edited its job. Daily refusal watch, 2026-11-28: ``` [gateway] cron: job updated [agent/embedded] session target preparation refused reason=scope_authority_refused lane task error: lane=cron-nested durationMs=36667 error="Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed" ``` `captureCronJobTurnTarget` (`src/gateway/cron-job-turn-target.ts`) gave the session event target an `assertCurrent` that re-read the job on every fence check. It compared the stored `operatorSource` (or the scheduled requester) with the value captured at start. `cron.update` changes that value, so the next fence check threw. The run's `assertScopeCurrent` turned it into `scope_authority_refused`. The cron notice and failure-repair turns use this target. A repair turn that fixes its own job killed itself. Root `AGENTS.md` "Decide authority once" does not allow this: authority is checked once, when work starts. The only stop after start is a permission writer stopping a named person's work. Editing a job is neither. This is the same class as R7 `source_authority_refused` (removed in #205268). ## Change - Remove both job re-reads from `captureCronJobTurnTarget`: the operator-source comparison ("Automation operator source changed") and the scheduled-requester comparison ("Automation requester changed."). - The edited source applies from the next occurrence. Admission at that start decides it. - Kept: admission at start, data fences (attempt lifecycle, session identity, target fields), the run abort signal, and the cron remove/disable cancellation (active-job marker → run `AbortController`). - `scope_authority_refused` stays. The run-registry binding (`source-closed`) still produces it. `scripts/lib/no-operator-permission-read.mjs` lists no removed site. ## What the user sees A cron notice or repair turn finishes after the job is edited. Before, it failed with "This agent run is no longer active. Start a new turn to retry." ## Evidence - New test `keeps a started cron turn running when its job is edited` (`src/gateway/operator-run-recovery.effects.test.ts`). It uses the real `CronService`, `captureCronJobTurnTarget` and `prepareSessionEventTargetForHost`, then edits the stored job's `operatorSource`. - Base `848732ff`: red, `Error: Automation operator source changed`. - Head: green. - `ocx test` on the four test files that import `cron-job-turn-target.ts`: 35/35 pass. - `pnpm check:changed`: typecheck, lint, format and guards pass. The dead-export scan fails on base-only entries (`AgentCommandPluginIngressOpts`, `clearNativeRepositorySourceModulesForTest`, `resolveUpdateInstallSurfaceMock`). None of them are in this diff. - Live Gateway E2E (isolated Gateway, real `openai/gpt-5.5`, scratch state). Steps: the agent creates a cron job from chat with a 3 s timeout. `cron.run` fails, and the failure-repair turn starts in the owner session. The repair turn calls the cron tool to set `timeoutSeconds: 120` (`cron.update`), then runs one more `exec` and replies. - Base `848732ff`: the job edit lands, then the repair turn ends `state: error` with `Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed`. The Gateway log has `scope_authority_refused`. This is the incident. - Head `4d50bb57`: the job edit lands and the repair turn ends `state: final`. The log has no `scope_authority_refused`. - One-admission E2E Q/R/S on head `4d50bb57`: all PASS. Revoking access while work is queued refuses it visibly, revoking access while a turn runs stops it (`access-reduced`), and Stop cancels the turn. Production: −18/+6 lines. Test: +56/−1. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 7895017) Release adaptation: Remove the mutable job-source assertions while retaining beta.2 requesterOwner and delegated ownerContinuation option shapes; preserve the existing source-conversation fence. Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
…207947) A started cron turn died when someone edited its job. Daily refusal watch, 2026-11-28: ``` [gateway] cron: job updated [agent/embedded] session target preparation refused reason=scope_authority_refused lane task error: lane=cron-nested durationMs=36667 error="Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed" ``` `captureCronJobTurnTarget` (`src/gateway/cron-job-turn-target.ts`) gave the session event target an `assertCurrent` that re-read the job on every fence check. It compared the stored `operatorSource` (or the scheduled requester) with the value captured at start. `cron.update` changes that value, so the next fence check threw. The run's `assertScopeCurrent` turned it into `scope_authority_refused`. The cron notice and failure-repair turns use this target. A repair turn that fixes its own job killed itself. Root `AGENTS.md` "Decide authority once" does not allow this: authority is checked once, when work starts. The only stop after start is a permission writer stopping a named person's work. Editing a job is neither. This is the same class as R7 `source_authority_refused` (removed in #205268). - Remove both job re-reads from `captureCronJobTurnTarget`: the operator-source comparison ("Automation operator source changed") and the scheduled-requester comparison ("Automation requester changed."). - The edited source applies from the next occurrence. Admission at that start decides it. - Kept: admission at start, data fences (attempt lifecycle, session identity, target fields), the run abort signal, and the cron remove/disable cancellation (active-job marker → run `AbortController`). - `scope_authority_refused` stays. The run-registry binding (`source-closed`) still produces it. `scripts/lib/no-operator-permission-read.mjs` lists no removed site. A cron notice or repair turn finishes after the job is edited. Before, it failed with "This agent run is no longer active. Start a new turn to retry." - New test `keeps a started cron turn running when its job is edited` (`src/gateway/operator-run-recovery.effects.test.ts`). It uses the real `CronService`, `captureCronJobTurnTarget` and `prepareSessionEventTargetForHost`, then edits the stored job's `operatorSource`. - Base `848732ff`: red, `Error: Automation operator source changed`. - Head: green. - `ocx test` on the four test files that import `cron-job-turn-target.ts`: 35/35 pass. - `pnpm check:changed`: typecheck, lint, format and guards pass. The dead-export scan fails on base-only entries (`AgentCommandPluginIngressOpts`, `clearNativeRepositorySourceModulesForTest`, `resolveUpdateInstallSurfaceMock`). None of them are in this diff. - Live Gateway E2E (isolated Gateway, real `openai/gpt-5.5`, scratch state). Steps: the agent creates a cron job from chat with a 3 s timeout. `cron.run` fails, and the failure-repair turn starts in the owner session. The repair turn calls the cron tool to set `timeoutSeconds: 120` (`cron.update`), then runs one more `exec` and replies. - Base `848732ff`: the job edit lands, then the repair turn ends `state: error` with `Session target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed`. The Gateway log has `scope_authority_refused`. This is the incident. - Head `4d50bb57`: the job edit lands and the repair turn ends `state: final`. The log has no `scope_authority_refused`. - One-admission E2E Q/R/S on head `4d50bb57`: all PASS. Revoking access while work is queued refuses it visibly, revoking access while a turn runs stops it (`access-reduced`), and Stop cancels the turn. Production: −18/+6 lines. Test: +56/−1. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 7895017) Release adaptation: Replace the stable restored source snapshot equality assertion with the job-incarnation fence, retaining the revoked-device and profile checks and stable target ownership. Prove edits and removal against admitted repair target and authority. Companion audit: 213f9b9 applied immediately before this source; no other required companions. Co-authored-by: RomneyDa <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A started cron turn died when someone edited its job. Daily refusal watch, 2026-11-28:
captureCronJobTurnTarget(src/gateway/cron-job-turn-target.ts) gave the session event target anassertCurrentthat re-read the job on every fence check. It compared the storedoperatorSource(or the scheduled requester) with the value captured at start.cron.updatechanges that value, so the next fence check threw. The run'sassertScopeCurrentturned it intoscope_authority_refused. The cron notice and failure-repair turns use this target. A repair turn that fixes its own job killed itself.Root
AGENTS.md"Decide authority once" does not allow this: authority is checked once, when work starts. The only stop after start is a permission writer stopping a named person's work. Editing a job is neither. This is the same class as R7source_authority_refused(removed in #205268).Change
captureCronJobTurnTarget: the operator-source comparison ("Automation operator source changed") and the scheduled-requester comparison ("Automation requester changed.").AbortController).scope_authority_refusedstays. The run-registry binding (source-closed) still produces it.scripts/lib/no-operator-permission-read.mjslists no removed site.What the user sees
A cron notice or repair turn finishes after the job is edited. Before, it failed with "This agent run is no longer active. Start a new turn to retry."
Evidence
keeps a started cron turn running when its job is edited(src/gateway/operator-run-recovery.effects.test.ts). It uses the realCronService,captureCronJobTurnTargetandprepareSessionEventTargetForHost, then edits the stored job'soperatorSource.848732ff: red,Error: Automation operator source changed.ocx teston the four test files that importcron-job-turn-target.ts: 35/35 pass.pnpm check:changed: typecheck, lint, format and guards pass. The dead-export scan fails on base-only entries (AgentCommandPluginIngressOpts,clearNativeRepositorySourceModulesForTest,resolveUpdateInstallSurfaceMock). None of them are in this diff.openai/gpt-5.5, scratch state). Steps: the agent creates a cron job from chat with a 3 s timeout.cron.runfails, and the failure-repair turn starts in the owner session. The repair turn calls the cron tool to settimeoutSeconds: 120(cron.update), then runs one moreexecand replies.848732ff: the job edit lands, then the repair turn endsstate: errorwithSession target preparation outlived its attempt | This agent run is no longer active. Start a new turn to retry. | Automation operator source changed. The Gateway log hasscope_authority_refused. This is the incident.4d50bb57: the job edit lands and the repair turn endsstate: final. The log has noscope_authority_refused.4d50bb57: all PASS. Revoking access while work is queued refuses it visibly, revoking access while a turn runs stops it (access-reduced), and Stop cancels the turn.Production: −18/+6 lines. Test: +56/−1.