Skip to content

fix(update): restore Windows task autostart after cancellation - #161990

Merged
steipete merged 1 commit into
mainfrom
codex/sqlite-snapshot-cwd-20260930
Sep 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sqlite-snapshot-cwd-20260930

Conversation

@steipete

@steipete steipete commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A Windows update cancelled after suspending Scheduled Task autostart can fail recovery with requester-revoked, leaving autostart disabled instead of finishing cancellation.

Related: #161881

User Impact

After successful suspension, cancelling before installation mutation restores the original task's autostart setting before exit. Forward update work remains cancelled, and restoration still checks the original update owner and native task identity.

This behavior belongs to the installed updater; a release containing the fix enables it for that release's next update. The separate native failed-/DISABLE fallback is outside this change.

Why This Change Was Made

Windows recovery was using the forward execution guard after interruption had deliberately closed forward admission. Pass the existing restore phase only through restoration, compensating re-disable, and recovery settlement. Suspension, mutation admission, and handoff retain forward checks. The existing executor, invocation, and service-identity owners continue to decide authority.

The signal regression now invokes the real beforeMutation and assertCurrent callbacks from its resume mock, instead of skipping the boundary that failed. No dependencies, schemas, permissions, timeouts, retries, or new test cases are added.

Evidence

  • Original hosted failure: CI run 36745345417, job 109990580690, restores Windows Scheduled Task autostart on SIGINT during package suspension (1 failed / 680 passed across 37 files). The exact original-order group reproduced that result locally in 883.30s.
  • Focused A/B on tested merge 01b2bf1ecb7f4b132ffe536e689b17845d788a18, with and without the unrelated SQLite production changes, failed identically with managed-service-stop-failed: UpdateRequesterRevokedError: requester-revoked (78.18s / 66.05s). The updater/test bytes were identical; the three SQLite files were restored from tested main parent 1b31d2443e51dccc595b3e7208b8b696df26e222. Both runs used the canonical CI shard entrypoint on macOS arm64 / Node 24.21.0. No inherited-failure waiver is requested.
  • The strengthened callback regression failed before the fix (81.29s wrapper) and passed fixed (56.99s), using identical test bytes.
  • pnpm test src/cli/update-cli.windows-lifecycle.test.ts src/cli/update-cli/update-command-windows-task.test.ts src/cli/update-cli/update-command-service-maintenance.windows-recovery.test.ts --maxWorkers=1: 31 passed, 182.30s wrapper. Existing SIGINT and SIGBREAK cases took 4.807s and 3.753s. Coverage includes changed-task refusal, executor loss, transferred/closed recovery, failed restoration, and compensating re-disable. These exercise Windows control callbacks on macOS; they are not a native Windows scheduler run.
  • Main's separate vanished-cwd repair, 8e303782bb5677edbb27c77c222b568fb692dbbf, is already in the base. Its unchanged failing updater case passed with this Windows-only patch (13.361s test / 64.69s wrapper). No SQLite changes are carried here.
  • pnpm check:changed passed, including production types, all 27 selected test type graphs, lint, export scans, and boundary guards. Final docs formatting and Markdown lint passed (zero issues); git diff --check passed.
  • Isolated full-candidate autoreview completed clean through P2.
  • Exact-head CI run 36752477550 passed on 50f76a5f080b53d4329e88279b809399d2854925: 148 successful / 21 skipped; openclaw/ci-gate and applicable security checks passed. No failed or cancelled test coverage was waived.
  • Published [email protected] → exact candidate 50f76a5f package cell passed on Linux arm64 / Node 24.21.0: 582s lane, 619s overall. The real updater returned status: ok; its receipt finished with status: succeeded. Installed identity, migrations, post-update Doctor, dependency cleanup, registry checks, and Gateway readiness/status passed. Cleanup joined and the container is absent. Candidate tarball SHA-256: 36c166181f74901d43fe174956380e8e2c33e271a73581fbe6c1f387824eb6aa. The existing migration fixture accepts this published baseline; no fixture or assertion was changed.
  • Native Windows owner A/B verified the exact fix on Azure lease cbx_ec68e02f1719 (run record). Real CTRL_BREAK_EVENT delivery produced SIGBREAK and exit 130. The baseline left an initially enabled task disabled with requester-revoked; the fixed owner restored it; an initially disabled task stayed disabled. All three children joined and all three uniquely owned tasks were deleted.
  • This is native component proof with real Scheduler calls, task-identity checks, and the production service-operation lock. Its run record is synthetic and unpersisted; it does not claim full CLI, executor-lease, or ledger cancellation proof. The full CLI callback regression and published-updater compatibility cell cover their separate boundaries.
  • The Windows command's overall exit was 1, after all native assertions and task-deletion receipts passed, because PowerShell failed deleting a long temporary pnpm-store path. That result is retained. Explicit stop and independent inspection confirmed the lease released and not ready; controllers joined. The initial archive-transfer attempt also released its lease and had commandMs=0, so it supplied no product evidence. No proof rerun concealed either result.
Native Windows command and state observations

The temporary four-file harness ran from exact head 50f76a5f080b53d4329e88279b809399d2854925; it changed no product source.

node scripts/crabbox-wrapper.mjs run --target windows --windows-mode normal --fresh-pr 'openclaw/openclaw#161990' --apply-local-patch --no-hydrate --timing-json --ttl 90m --idle-timeout 30m --stop-after always --label windows-cancel-native-fresh-pr -- powershell.exe -NoProfile -NonInteractive -File proof-native-windows/run.ps1
Cell Initially enabled After suspension After cancellation
Original owner true false false (requester-revoked)
Fixed owner true false true
Fixed, initially disabled false false false

Every cell observed SIGBREAK, rejected forward work, exited 130, and joined. The fixed enabled case checked native task identity during suspension and again before restoration. Cell times were 26.026s, 8.369s, and 8.293s. Native runtime: Node 24.19.0, Windows x64. Cold dependency setup took 14m39.8s.

Verified SHA-256 values:

original owner d6766bf7eb8a9ea0d867b1cfb94ce4bd3c3e2f0f6f78f12a62ae247b32b03065
fixed owner    52288d5a3b9370266cda7bc7a63c33dee451b4782f291c7193c281b8a75ee725
execution guard 386494a00241ba84f08c67871a48dff441c16765f1689b467b6bd36342ffac12

The portal had a stdout-event append timeout; the inspected local capture contains all three distinct cells and cleanup receipts. Its failure summary repeats some lines, rather than representing additional executions.

No CHANGELOG edit.

@steipete steipete self-assigned this Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 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 size: S labels Sep 30, 2026
@steipete
steipete marked this pull request as ready for review September 30, 2026 16:35
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 2:18 PM ET / 18:18 UTC (Revision 7).

ClawSweeper review

What this changes

The branch lets the updater restore or compensate Windows Scheduled Task autostart after cancellation and updates the signal regression test and CLI documentation.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open. Current main still uses forward admission during Windows cancellation recovery, and the focused repair has no identified code defect. Native Windows Scheduled Task proof remains the landing gate.

Priority: P2
Reviewed head: 50f76a5f080b53d4329e88279b809399d2854925

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair and regression evidence are strong, with native Windows behavior still awaiting direct proof.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its reported before/after update-command run exercises cancellation with mocked Scheduler controls, and its published-driver-to-candidate run covers Linux upgrade behavior; the repository's separate native Windows platform proof remains pending. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its reported before/after update-command run exercises cancellation with mocked Scheduler controls, and its published-driver-to-candidate run covers Linux upgrade behavior; the repository's separate native Windows platform proof remains pending. No stored-data contract changes.
Evidence reviewed 8 items Introduced recovery change: The pinned introduced diff passes the existing restore phase through task restoration, compensation, and settlement while leaving initial suspension and mutation admission on forward checks.
Current main still needs the repair: Fetched main passes the forward assertion into the restoration callback; the comparison with the PR head contains the proposed correction.
Retained authority checks: Restore-phase admission still pins the invocation and checks the live executor. The native control path checks its operation lock and caller immediately before the Scheduled Task change.
Findings None None.
Security None None.

How this fits together

The update command temporarily disables Gateway Scheduled Task autostart while preparing an installation change. Its recovery path checks the original update executor and task before restoring autostart or reporting a failure.

flowchart LR
 A[Update command] --> B[Task autostart suspended]
 B --> C[Cancellation signal]
 C --> D{Executor and task current?}
 D -->|Yes| E[Restore autostart]
 D -->|No| F[Report recovery failure]
 B --> G[Installation mutation]
Loading

Before merge

  • Resolve merge risk (P1) - A native Windows cancellation run has not yet shown the Scheduled Task returning to its prior autostart state and refusing restoration after task ownership changes.
  • Complete next step (P2) - Capture native Windows Scheduled Task cancellation proof, including restored autostart and refusal after task ownership changes, before normal landing.
Agent review details

Security

None.

PR surface

Source -2, Tests +11, Docs +6. Total +15 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 14 16 -2
Tests 1 12 1 +11
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 32 17 +15

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Capture native cancellation proof (recommended)
    Run the candidate updater against a real Windows Scheduled Task and record both autostart restoration after cancellation and refusal after task ownership changes.

Technical review

Best possible solution:

Keep phase-scoped compensation in the installed updater, with a native Windows cancellation run demonstrating restoration and changed-owner refusal before landing.

Do we have a high-confidence way to reproduce the issue?

Yes. The reported hosted failure and pre-fix callback regression identify the cancellation path, while current main still contains the forward-check call; native Windows behavior remains to be demonstrated.

Is this the best way to solve the issue?

Yes. Passing the existing restore phase only through compensation is a narrow repair that retains forward mutation fencing and the existing executor and task checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b475dc5df407.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Cancellation can leave Windows Gateway autostart disabled, but the failure is limited to that update recovery path.
  • merge-risk: 🚨 availability: A failed or misdirected native restoration could leave the Gateway Scheduled Task disabled after cancellation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its reported before/after update-command run exercises cancellation with mocked Scheduler controls, and its published-driver-to-candidate run covers Linux upgrade behavior; the repository's separate native Windows platform proof remains pending. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0b3de8a adds src/cli/update-cli/update-command-execution-guards.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0b3de8ae20b2; files: src/cli/update-cli/update-command-execution-guards.ts)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record native Windows cancellation restoring the original task and refusing a changed task before the Scheduler command.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-30T16:42:35.202Z sha 176f0d39e754819850f707e7a1605b7cca3b5a00 :: blocked before merge. :: none
  • reviewed 2026-09-30T16:59:01.786Z sha 176f0d39e754819850f707e7a1605b7cca3b5a00 :: blocked before merge. :: none
  • reviewed 2026-09-30T17:08:43.301Z sha 176f0d39e754819850f707e7a1605b7cca3b5a00 :: blocked before merge. :: none
  • reviewed 2026-09-30T17:23:11.672Z sha 176f0d39e754819850f707e7a1605b7cca3b5a00 :: blocked before merge. :: none
  • reviewed 2026-09-30T17:41:41.487Z sha 50f76a5 :: blocked before merge. :: none
  • reviewed 2026-09-30T18:01:59.640Z sha 50f76a5 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 30, 2026
@steipete
steipete marked this pull request as draft September 30, 2026 17:34
@steipete steipete changed the title fix(sqlite): preserve retained snapshots after cwd removal fix(update): restore Windows task autostart after cancellation Sep 30, 2026
@steipete
steipete force-pushed the codex/sqlite-snapshot-cwd-20260930 branch from 176f0d3 to 50f76a5 Compare September 30, 2026 17:34
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS and removed size: S labels Sep 30, 2026
@steipete
steipete marked this pull request as ready for review September 30, 2026 17:35
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 30, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 30, 2026
@steipete
steipete merged commit 05d3c90 into main Sep 30, 2026
325 of 328 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 30, 2026
Integrate main f02c8eb for the actual merge conflict. Keep the canonical Windows recovery source, tests, and documentation from #161990 without a competing repair.

The 18 catalog files are unchanged from fe2610d. Post-resolution Testbox proof passed 54 catalog adoption, composed performance, and Windows recovery/ownership cases.
steipete added a commit that referenced this pull request Sep 30, 2026
Preserve canonical #161990, its real callback fixture and documentation. Retain the separately proven failed-disable compensation and pre-stop cleanup fixes; the resulting change against main spans four files.
steipete added a commit that referenced this pull request Sep 30, 2026
Carry the reviewed residual from #162050 at db545dc while preserving canonical #161990 restoration forwarding. Keep forward admission strict and use the original restore authority only for failed-disable compensation and pre-stop cleanup. The original executor and native service checks remain intact.

The owning exact-main controls fail before the repair; the composed original CLI and native recovery suites pass 30 cases under simulated win32 on Darwin. Full selected checks and independent review passed at the repair owner. This receiving cut preserves the four qualified postimages exactly; it makes no native Windows execution claim.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
steipete added a commit that referenced this pull request Oct 1, 2026
* fix(plugins): await activation health cleanup

* fix(update): preserve Windows cancellation compensation

Carry the reviewed residual from #162050 at db545dc while preserving canonical #161990 restoration forwarding. Keep forward admission strict and use the original restore authority only for failed-disable compensation and pre-stop cleanup. The original executor and native service checks remain intact.

The owning exact-main controls fail before the repair; the composed original CLI and native recovery suites pass 30 cases under simulated win32 on Darwin. Full selected checks and independent review passed at the repair owner. This receiving cut preserves the four qualified postimages exactly; it makes no native Windows execution claim.

* refactor(plugins): keep activation cleanup scope focused

Canonical Windows restoration fixes already resolve the original CI blocker. Leave the distinct failed-DISABLE compensation and additional regressions solely with #162050 instead of carrying its independent product change here. Preserve all 40 qualified activation file contents and the canonical updater owners.

* test(gateway): bound hot-reload failure diagnostics

Record phase, queued-result and lifecycle scalars only when the existing reload fixture fails. Preserve all waits, assertions and cleanup while replacing full serialized model requests with bounded diagnostics. The original CI timeout remains unattributed; the larger-host Linux pass is negative reproduction, not a failure waiver.

* fix(github-copilot): reuse host-authorized setup credentials

Fix red main exposed by 3c0ae56 (#162020), which added real Gateway
retry coverage. Bisect confirms its parent passes and that commit first
fails because the expected existing-account confirmation becomes a login note.

Setup already supplies the saved profile, but Copilot's separate runtime
store lookup sees none. Use the host-authorized existingProfiles contract
introduced by 67fd7e9 for selection and resolve the selected credential's
SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes,
and the unchanged first-signin integration assertions.

Extend the provider cases for authorized re-login, reference-backed reuse,
and absent/empty candidate lists. All four regressions fail on the old owner.
Remove the retired TTY fixture and consolidate assertions without increasing
the test file's counted lines.

Validation: exact first-signin integration 3/3 passes; 277 sibling tests in
18 files; 56 provider tests (22.14s wall with one worker); core typecheck;
changed-file checks; formatting and git diff --check. Independent autoreview
through P1 completed before commit.

* test(plugins): supply authorized Copilot reuse profiles

Keep the shared provider auth contract fixture aligned with the existing host-authorized profile input used by the canonical Copilot reconnect repair. Preserve its original credential, model and configuration assertions. This is the exact reviewed fixture-only handoff from the independent reconnect owner; its separate authority follow-up remains outside this change.
roboclaw-bot added a commit to VACInc/openclaw that referenced this pull request Oct 1, 2026
Reuse main's canonical cancellation compensation owner from 05d3c90 (openclaw#161990), removing the parallel production implementation during conflict resolution. Preserve both regressions through its existing restore-phase API: forward cancellation permits original-task compensation, while owner revocation across inspection denies enabling.

Four affected Windows test files passed 38 cases on this base; CLI-update test types, focused lint/format and GPT 6 Astra P0-P2 reconciliation review pass. Earlier full feature evidence remains revision-scoped.

Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…law#161952)

* fix(plugins): await activation health cleanup

* fix(update): preserve Windows cancellation compensation

Carry the reviewed residual from openclaw#162050 at db545dc while preserving canonical openclaw#161990 restoration forwarding. Keep forward admission strict and use the original restore authority only for failed-disable compensation and pre-stop cleanup. The original executor and native service checks remain intact.

The owning exact-main controls fail before the repair; the composed original CLI and native recovery suites pass 30 cases under simulated win32 on Darwin. Full selected checks and independent review passed at the repair owner. This receiving cut preserves the four qualified postimages exactly; it makes no native Windows execution claim.

* refactor(plugins): keep activation cleanup scope focused

Canonical Windows restoration fixes already resolve the original CI blocker. Leave the distinct failed-DISABLE compensation and additional regressions solely with openclaw#162050 instead of carrying its independent product change here. Preserve all 40 qualified activation file contents and the canonical updater owners.

* test(gateway): bound hot-reload failure diagnostics

Record phase, queued-result and lifecycle scalars only when the existing reload fixture fails. Preserve all waits, assertions and cleanup while replacing full serialized model requests with bounded diagnostics. The original CI timeout remains unattributed; the larger-host Linux pass is negative reproduction, not a failure waiver.

* fix(github-copilot): reuse host-authorized setup credentials

Fix red main exposed by c3dd660 (openclaw#162020), which added real Gateway
retry coverage. Bisect confirms its parent passes and that commit first
fails because the expected existing-account confirmation becomes a login note.

Setup already supplies the saved profile, but Copilot's separate runtime
store lookup sees none. Use the host-authorized existingProfiles contract
introduced by 0d6ab3c for selection and resolve the selected credential's
SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes,
and the unchanged first-signin integration assertions.

Extend the provider cases for authorized re-login, reference-backed reuse,
and absent/empty candidate lists. All four regressions fail on the old owner.
Remove the retired TTY fixture and consolidate assertions without increasing
the test file's counted lines.

Validation: exact first-signin integration 3/3 passes; 277 sibling tests in
18 files; 56 provider tests (22.14s wall with one worker); core typecheck;
changed-file checks; formatting and git diff --check. Independent autoreview
through P1 completed before commit.

* test(plugins): supply authorized Copilot reuse profiles

Keep the shared provider auth contract fixture aligned with the existing host-authorized profile input used by the canonical Copilot reconnect repair. Preserve its original credential, model and configuration assertions. This is the exact reviewed fixture-only handoff from the independent reconnect owner; its separate authority follow-up remains outside this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant