Skip to content

fix(windows): recover Gateway restarts from SQLite sharing errors - #159347

Merged
steipete merged 6 commits into
mainfrom
upd/upd-windows-stop-sqlite-ioerr
Sep 28, 2026
Merged

steipete merged 6 commits into
mainfrom
upd/upd-windows-stop-sqlite-ioerr

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #159222

Reported by @eddiekk. Auto-merge remains enabled.

What Problem This Solves

Fixes Windows Scheduled Task Gateway stop/restart failing with SQLITE_IOERR_TRUNCATE after task termination, and failed task inspection leaving restart offline while reporting completion.

User Impact

Stop requests graceful shutdown first. Restart retries transient SQLite sharing errors, preserves replacement processes, and waits for task settlement. If settlement inspection stays unavailable after confirmed Gateway exit, it still attempts /Run and reports restart as unverified. It never reports a completed restart for an owner-change path that skipped activation.

Why This Change Was Made

The Windows driver ended the task before reading its SQLite owner lease. The dying process could still hold WAL/SHM handles, and the first I/O error prevented /Run. The existing lifecycle owner now captures process/start identities before shutdown, retries recognized sharing errors, and records recovery after confirmed exit. Pre-existing matching children are captured together; cleanup never adopts a later replacement.

Task settlement returns a closed settled / replaced / unavailable union. An observed replacement is preserved and reported as a refusal. Unavailable inspection retries within the existing stop budget, then permits the requested recovery attempt after confirmed exit, with an explicit unverified error. Continued positive Running observations still require settlement or the /End fallback. Native /Run errors retain the settlement fact; accepting /Run does not claim successor health.

The broader activation-authority and successor-preflight redesign remains in follow-up #159729, requiring Peter's design sign-off. Its patch remains in .local/l1307-fence.patch. Service-specific graceful-RPC credential projection remains a named follow-up.

Evidence

  • Conflict-resolution proof on the current head: preserved main’s users.merge method position and appended gateway.stop.request, updated the existing ordering assertions, and regenerated Kotlin. The full protocol chain passed again. All 14 touched suites / 320 tests passed three times locally, command wall 217.616 s / 77.471 s / 49.323 s. The cold Gateway shard took 165.55 s, with only 1% test time (transform 74%, worker preparation 19%); longest individual case across all runs was 5.587 s. Lifecycle patches are unchanged by the rebase. Fresh direct-route Codex P1 review after the rebase was scoped-clean.
  • Protocol: gateway.stop.request is an additive core method in train 2026.9; no protocol version bump is needed. The full local chain passed: pnpm protocol-registry:check && pnpm protocol:gen && pnpm protocol:check:swift && pnpm protocol:gen:kotlin && node --import ./scripts/tsx.mjs scripts/check-protocol-since.mts. The since guard passed (one new core method, zero restored compatibility methods). Generation added the missing Kotlin enum entry; Swift was current and the schema build artifact was regenerated. A fresh direct-route Codex P1 review of the generated-only delta was scoped-clean.
  • Production reduced from net +573 to +214 (+473/-259), including the one-line generated Kotlin protocol entry (lifecycle implementation: +213). Tests/support: +1121 (+1376/-255). Docs +11; Windows test-list tooling +1/-1. No dependency, SQLite schema, CLI/config option, suppression, or baseline growth changes.
  • Regression controls failed before the fixes: timed-out inspection returned completed without /Run, and owner changes reported completion without activation. Coverage includes transient retry, persistent unavailability, denied /Run, denied /End followed by unavailable inspection, observed replacement, standalone stop, and no captured owner. Settlement cases are split into their own file by concern.
  • Touched suites on Linux Testbox tbx_01m3ja71x3qbkecmzrr33zgk7t: 320 passed three times, wrapper 43.41 s / 30.51 s / 28.90 s. All 128 importer selectors ran: 3,039 passed / 13 skipped, plus E2E preparation 4 passed / 1 Windows-only skip, exit 0. Full remote command 1,291.183 s. Ordinary importers and E2E preparation use separate build preparation.
  • Follow-up (maintainer waiver): optimize the pre-existing update-command-original-service.test.ts fixture; 126.867 s across 67 cases, unchanged in this PR.
  • node scripts/check-changed.mjs --base origin/main, Testbox tbx_01m3jcw2zfd0q4fcqdg3zts4nd: passed, exit 0, remote command 1,811.469 s after the no-shadow fix. All types, lint, unused-export, line-cap, and runtime guards passed.
  • Fresh direct-route Codex P1 review: scoped-clean, with no accepted/actionable P0 or P1 findings; the maintainer accepted the staged repair and its existing proof.
  • Windows proof on 812235f313934560aba7d28cb9c44f02e33336f6 (before the generated-only Kotlin correction), run 36354719773, job 108720043497: passed, 321/321 tests, three projects in the declared order; wrapper 123.70 s. The native Windows state probe is included. Longest individual test: 12.597 s.
  • Rebased once to resolve a real merge conflict onto 1ea24b2dc36f809ff2113965ef4ca6ba6c1387f9; upstream e9af8ebcde6b25813d2fdb45662fe40dd4452089 fixed the unrelated task-registry type error. This PR leaves that test untouched.
  • Head: 8708d59347fd035c4cb7a67986ef33e910357c6d.
  • Installed-CLI restart proof gap: the harness has no real installed candidate openclaw gateway restart cell. Existing install/update/readiness/stop coverage and a source restart probe do not prove installed CLI preflight. This gap remains explicit in the follow-up.
Per-file test time (seconds, summed Vitest cases)
File Linux Windows
src/gateway/server-methods-list.test.ts 0.075 0.077
src/gateway/server-methods/restart.test.ts 0.104 0.130
src/gateway/server-methods/stop.test.ts 0.445 0.595
src/daemon/schtasks.startup-fallback.test.ts 0.518 1.965
src/daemon/schtasks.stop.test.ts 2.552 33.006
src/daemon/schtasks.install.test.ts 0.260 0.375
src/daemon/schtasks.shutdown.test.ts 0.151 1.078
src/daemon/schtasks-install-rollback.test.ts 0.197 0.456
src/daemon/schtasks.settlement.test.ts 1.641 22.870
src/daemon/schtasks.startup-launch.test.ts 0.021 0.064
src/daemon/schtasks-owner-publication.test.ts 0.039 0.074
src/daemon/schtasks.update-autostart.test.ts 0.034 0.218
src/daemon/schtasks-state-probe.test.ts 0.028 0.067
src/daemon/schtasks.redirect-stop.test.ts 0.012 0.037

Whole-command wall times are reported above. The Windows stop suite spends 33.0 seconds across 48 cases, primarily serializing production COM queries while virtual time walks the stop budget; these owner-boundary cases cover localized native failures, settlement, and refusal. Tests add no real sleeps, retries, weaker assertions, or skipped regressions.

@clawsweeper

clawsweeper Bot commented Sep 27, 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 gateway Gateway runtime size: L labels Sep 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 27, 2026, 9:12 PM ET / September 28, 2026, 01:12 UTC (Revision 15).

ClawSweeper review

What this changes

The branch changes Windows Scheduled Task Gateway stop and restart to request graceful shutdown, retry transient SQLite lease reads, inspect task settlement, and report recovery, with a new Gateway RPC, Android protocol entry, documentation, and tests.

Regression provenance

Possible regression — suspected (failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 13 items remain

Keep open. Current main still has the reported Windows restart failure, and the smaller open retry PR has not superseded this work. Three process-authority and result-reporting defects remain on this head, and the installed restart boundary lacks proof.

Priority: P0
Reviewed head: 8708d59347fd035c4cb7a67986ef33e910357c6d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The branch has substantial regression coverage, but the process-authority and stop-result defects plus missing final-effect proof prevent a merge-ready rating.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the changed Windows driver can terminate captured PIDs and launch a Scheduled Task, but the cited Windows job ran tests and a native probe while installed lifecycle steps were skipped. No installed candidate CLI restart shows a ready successor or rejection of an unrelated process and changed task before final I/O. No stored-data contract changes are introduced. Redact private host, account, and credential details from proof; updating the PR body should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the changed Windows driver can terminate captured PIDs and launch a Scheduled Task, but the cited Windows job ran tests and a native probe while installed lifecycle steps were skipped. No installed candidate CLI restart shows a ready successor or rejection of an unrelated process and changed task before final I/O. No stored-data contract changes are introduced. Redact private host, account, and credential details from proof; updating the PR body should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Current main retains the failure path: Current main reads the owner lease directly during Scheduled Task ownership resolution and has no stop-request RPC or transient lease-read retry. The reporter's official v2026.9.6 trace reaches this read after task termination.
Introduced child capture: The PR adds every additional snapshot row matching installed Gateway arguments to the captured PID list. That match does not establish membership in the captured task instance.
Final process effect: The stop loop sends each captured PID to process-tree termination. Its current check binds PID start time and the original owner lease, but does not prove that an additional PID belongs to that owner's task.
Findings 3 actionable findings [P1] Bind each captured child to the original task
[P1] Verify the captured task before an uninspected /Run
[P1] Return a refusal when stop preserves a replacement
Security Needs attention Unrelated process can inherit cleanup authority: Matching installed arguments do not establish that an extra PID belongs to the captured Scheduled Task; the stop loop can pass that PID to taskkill /T.

How this fits together

The Windows service driver receives Gateway stop and restart requests from the CLI and service lifecycle. It combines the SQLite owner lease with Windows process and task observations before stopping processes, launching a task, and reporting the outcome.

flowchart TD
  A[CLI service request] --> B[Windows service driver]
  B --> C[SQLite owner lease]
  B --> D[Process and task observations]
  C --> E[Ownership decision]
  D --> E
  E --> F[Graceful stop or process termination]
  F --> G[Task settlement]
  G --> H[Task launch and result]
Loading

Decision needed

Question Recommendation
May Windows restart issue /Run after the captured Gateway exits when Task Scheduler settlement remains unavailable and the task identity cannot be revalidated at activation? Require current task authority: Refuse the unverified /Run path until the driver can bind activation to the captured task instance and definition, while retaining the SQLite retry repair.

Why: That choice trades recovery against the risk of activating a changed or already-running task; the PR body's acceptance claim does not independently establish a decision covering this final-effect boundary, and the separate follow-up reserves the broader handoff design for sign-off.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the changed Windows driver can terminate captured PIDs and launch a Scheduled Task, but the cited Windows job ran tests and a native probe while installed lifecycle steps were skipped. No installed candidate CLI restart shows a ready successor or rejection of an unrelated process and changed task before final I/O. No stored-data contract changes are introduced. Redact private host, account, and credential details from proof; updating the PR body should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Bind each captured child to the original task (P1) - The new snapshot scan adds every process with matching Gateway arguments. A PID start-time check does not prove that an added process belongs to the captured task, so an unrelated same-command process can reach taskkill.
  • Verify the captured task before an uninspected /Run (P1) - When settlement inspection remains unavailable, this branch permits /Run after the Gateway exits without revalidating the task instance or definition at activation. Task Scheduler can accept an ignored duplicate launch, and a changed task name can target a different definition; retain task authority through activation or refuse this path.
  • Return a refusal when stop preserves a replacement (P1) - When listener cleanup preserves a replacement, stopScheduledTask prints that fact and resolves normally. The CLI can report a successful stop while the requested Gateway remains running; return a distinct refusal or error.
  • Resolve security concern: Unrelated process can inherit cleanup authority - Matching installed arguments do not establish that an extra PID belongs to the captured Scheduled Task; the stop loop can pass that PID to taskkill /T.
  • Resolve merge risk (P1) - Additional matching-command PIDs can reach taskkill without proof that they belong to the captured task instance.
  • Resolve merge risk (P1) - After unavailable task inspection, restart can issue /Run without current task-instance authority; a changed task or an ignored duplicate launch may leave recovery unverified.
  • Resolve merge risk (P1) - The new pre-stop LastRunTime requirement can refuse stop or restart for an existing installation when Task Scheduler inspection is unavailable; its upgrade behavior has not been proven.
  • Complete next step (P2) - Repair child attribution and preserved-replacement stop reporting; resolve final /Run authority and add installed Windows final-effect proof before merge.
  • Improve patch quality - Bind each captured PID to the original task instance and prove an unrelated matching-command process is rejected before taskkill.
  • Improve patch quality - Report a preserved replacement as a refused stop and resolve the final /Run authority choice.
  • Improve patch quality - Capture a redacted installed-candidate Windows restart trace showing successor readiness and final-effect rejection for a changed task.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Bind each captured child to the original task — src/daemon/schtasks-process.ts:333-337
  • [P1] Verify the captured task before an uninspected /Run — src/daemon/schtasks-process.ts:617-622
  • [P1] Return a refusal when stop preserves a replacement — src/daemon/schtasks-control.ts:392-399
  • [high] Unrelated process can inherit cleanup authority — src/daemon/schtasks-process.ts:334
Agent review details

Security

Needs attention: The new process-capture path can carry termination authority to an unrelated matching-command process; no dependency or supply-chain change was found.

PR surface

Source +213, Tests +1121, Docs +11, Config 0, Other +1. Total +1346 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 7 472 259 +213
Tests 12 1376 255 +1121
Docs 1 11 0 +11
Config 1 1 1 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 22 1861 515 +1346

Review metrics

Metric Value Why it matters
Production versus test growth production +214 net lines; tests and support +1,121 net lines The PR explains the lifecycle growth and records test cost, but its new authority boundary still needs final-effect validation.
Privileged protocol surface 1 core Gateway method added The new stop request has operator-admin write authority and reaches the host lifecycle side effect.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #159222
Summary: This PR proposes a repair for the reported Windows SQLite stop/restart failure, while a smaller open PR overlaps on the lease retry and a separate issue tracks the broader activation handoff.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair authority and outcome before merge (recommended)
    Bind every cleanup PID and final activation to the captured task, return a refusal for a preserved replacement, and prove the installed restart path.
  2. Accept only the activation tradeoff
    A maintainer may explicitly accept warned unverified activation after the independent process-ownership and stop-result defects are repaired.
  3. Narrow the repair
    If exact activation authority is too broad for this branch, retain a focused SQLite retry repair and leave the larger lifecycle handoff to the open follow-up.

Technical review

Best possible solution:

The Windows lifecycle owner should recover a ready Gateway from transient SQLite sharing failures while binding cleanup and activation to the captured task, reporting refusals accurately, and offering an in-product Fix action when recovery cannot complete.

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

Yes. The reporter supplied Windows Scheduled Task CLI steps and a captured SQLITE_IOERR_TRUNCATE stack on v2026.9.6; current main has the matching stop-then-lease-read path. This review did not execute the intermittent Windows race.

Is this the best way to solve the issue?

No. The existing Windows service driver is the right repair owner, but this branch must bind captured children and final task activation to current authority and report a preserved replacement as a refusal.

Full review comments:

  • [P1] Bind each captured child to the original task — src/daemon/schtasks-process.ts:333-337
    The new snapshot scan adds every process with matching Gateway arguments. A PID start-time check does not prove that an added process belongs to the captured task, so an unrelated same-command process can reach taskkill.
    Confidence: 0.94
  • [P1] Verify the captured task before an uninspected /Run — src/daemon/schtasks-process.ts:617-622
    When settlement inspection remains unavailable, this branch permits /Run after the Gateway exits without revalidating the task instance or definition at activation. Task Scheduler can accept an ignored duplicate launch, and a changed task name can target a different definition; retain task authority through activation or refuse this path.
    Confidence: 0.88
  • [P1] Return a refusal when stop preserves a replacement — src/daemon/schtasks-control.ts:392-399
    When listener cleanup preserves a replacement, stopScheduledTask prints that fact and resolves normally. The CLI can report a successful stop while the requested Gateway remains running; return a distinct refusal or error.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P0: The reported Windows restart failure can leave the Gateway and channels offline until a user performs manual Task Scheduler recovery.
  • merge-risk: 🚨 security-boundary: The introduced matching-command child capture can grant taskkill authority over a process outside the captured task.
  • merge-risk: 🚨 availability: Unverified task activation and a preserved replacement reported as a successful stop can leave the Gateway in the wrong lifecycle state.
  • merge-risk: 🚨 compatibility: Existing Windows installations can now fail closed before stop when Task Scheduler cannot supply last-run identity.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the changed Windows driver can terminate captured PIDs and launch a Scheduled Task, but the cited Windows job ran tests and a native probe while installed lifecycle steps were skipped. No installed candidate CLI restart shows a ready successor or rejection of an unrelated process and changed task before final I/O. No stored-data contract changes are introduced. Redact private host, account, and credential details from proof; updating the PR body should trigger re-review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Unrelated process can inherit cleanup authority — src/daemon/schtasks-process.ts:334
    Matching installed arguments do not establish that an extra PID belongs to the captured Scheduled Task; the stop loop can pass that PID to taskkill /T.
    Confidence: 0.93

What I checked:

  • Current main retains the failure path: Current main reads the owner lease directly during Scheduled Task ownership resolution and has no stop-request RPC or transient lease-read retry. The reporter's official v2026.9.6 trace reaches this read after task termination. (src/daemon/schtasks-process.ts:213, 5cda19987e98)
  • Introduced child capture: The PR adds every additional snapshot row matching installed Gateway arguments to the captured PID list. That match does not establish membership in the captured task instance. (src/daemon/schtasks-process.ts:333, 8708d59347fd)
  • Final process effect: The stop loop sends each captured PID to process-tree termination. Its current check binds PID start time and the original owner lease, but does not prove that an additional PID belongs to that owner's task. (src/daemon/schtasks-process.ts:580, 8708d59347fd)
  • Preserved replacement reports stop success: A preserved replacement becomes a boolean returned to stopScheduledTask, which prints that the replacement was preserved and resolves successfully. The new shutdown test explicitly expects this outcome. (src/daemon/schtasks-control.ts:391, 8708d59347fd)
  • Unverified activation path: An unavailable settlement is allowed through after captured process exit; restart later calls /Run by task name after the stop helper releases its exclusion. The existing update-authority assertion does not revalidate the captured task definition or instance at that final effect. (src/daemon/schtasks-process.ts:617, 8708d59347fd)
  • Upgrade-sensitive stop admission: The new task-settlement preparation throws when Task Scheduler cannot provide LastRunTime, before the captured Gateway receives a graceful stop request. Current main instead begins the stop path with /End. (src/daemon/schtasks-state-probe.ts:283, 8708d59347fd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ben.Li: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-27T11:23:42.503Z sha 1ca8adb :: needs real behavior proof before merge. :: [P1] Settle the native task after fallback termination | [P1] Keep listener cleanup bound to the captured owner | [P1] Require process exit before reopening the lease | [P2] Fall back promptly after an explicit stop rejection | [P1] Hold exclusion through the final task launch
  • reviewed 2026-09-27T15:03:12.507Z sha 1ca8adb :: needs real behavior proof before merge. :: [P1] Settle the task supervisor after native termination | [P1] Keep listener cleanup bound to the captured Gateway | [P1] Require process exit before reopening the owner lease | [P2] Fall back promptly after an explicit stop rejection | [P1] Retain task authority through native end and activation
  • reviewed 2026-09-27T17:33:37.814Z sha 071038d :: needs real behavior proof before merge. :: [P1] Restore verified Startup runtime cleanup for Gateway tasks | [P1] Refuse a restart when task identity is unavailable
  • reviewed 2026-09-27T19:10:08.852Z sha bab994c :: needs real behavior proof before merge. :: [P1] Restore verified Startup cleanup for Gateway tasks | [P1] Verify additional PIDs belong to the captured task
  • reviewed 2026-09-27T19:38:11.983Z sha bab994c :: needs real behavior proof before merge. :: [P1] Restore verified Startup cleanup for Gateway tasks | [P1] Verify each additional PID belongs to the captured task
  • reviewed 2026-09-27T22:23:44.259Z sha 812235f :: needs real behavior proof before merge. :: [P1] Bind each captured child to the original task | [P1] Require task settlement before calling /Run
  • reviewed 2026-09-27T22:36:10.090Z sha 812235f :: needs real behavior proof before merge. :: [P1] Bind each captured child to the original task | [P1] Require task settlement before calling /Run | [P1] Return a refusal when stop preserves a replacement
  • reviewed 2026-09-28T00:10:42.046Z sha f80ccea :: needs real behavior proof before merge. :: [P1] Bind every captured child to the original task | [P1] Require task authority before the final /Run | [P1] Return a refusal when stop preserves a replacement

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. labels Sep 27, 2026
@steipete
steipete force-pushed the upd/upd-windows-stop-sqlite-ioerr branch from 1ca8adb to 071038d Compare September 27, 2026 17:21
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 19:30
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 8708d59347fd035c4cb7a67986ef33e910357c6d
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Sep 27, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Sep 27, 2026
@steipete
steipete enabled auto-merge (squash) September 27, 2026 22:41
@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Sep 28, 2026
Ask the verified Gateway owner to drain before Task Scheduler termination, wait for task completion, and retry transient Windows lease reads. Preserve restart activation with a warning when post-stop inspection remains unavailable and the port is free. Thanks @eddiekk for the failure traces.
Route Scheduled Task probes independently of CIM observation, retain listeners until their owned process is terminated, and revoke continuation authority at the intended post-End phase. Preserve owner termination and foreign-process protection assertions.
Keep cleanup bound to captured process identities, preserve later replacements,
and wait for the Scheduled Task to settle before activation. Record recovery
when transient SQLite owner inspection remains locked after confirmed exit.
@steipete
steipete force-pushed the upd/upd-windows-stop-sqlite-ioerr branch from f80ccea to 8708d59 Compare September 28, 2026 01:05
@steipete
steipete merged commit 5232aba into main Sep 28, 2026
255 checks passed
@steipete
steipete deleted the upd/upd-windows-stop-sqlite-ioerr branch September 28, 2026 01:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…enclaw#159347)

* fix(windows): recover Gateway restarts from SQLite sharing errors

Ask the verified Gateway owner to drain before Task Scheduler termination, wait for task completion, and retry transient Windows lease reads. Preserve restart activation with a warning when post-stop inspection remains unavailable and the port is free. Thanks @eddiekk for the failure traces.

* test(windows): tie stop fixtures to process termination

Route Scheduled Task probes independently of CIM observation, retain listeners until their owned process is terminated, and revoke continuation authority at the intended post-End phase. Preserve owner termination and foreign-process protection assertions.

* fix(windows): bind restart cleanup and wait for task settlement

Keep cleanup bound to captured process identities, preserve later replacements,
and wait for the Scheduled Task to settle before activation. Record recovery
when transient SQLite owner inspection remains locked after confirmed exit.

* fix(windows): preserve captured children and report refused stops

* fix(windows): recover restart after unavailable task inspection

* fix(android): regenerate gateway stop protocol method
chelsealong added a commit to chelsealong/openclaw that referenced this pull request Sep 28, 2026
chelsealong added a commit to chelsealong/openclaw that referenced this pull request Sep 28, 2026
terminateScheduledTaskGatewayListeners's per-pid loop rereads the owner
lease immediately before signaling the process, inside
terminateGatewayProcessTree's assertCurrent callback. That recheck was
not wrapped in the retryScheduledTaskLeaseRead retry that openclaw#159347 added
elsewhere, so a transient post-/End SQLITE_IOERR there still aborted
callers with no stop context to fall back on -- notably
schtasks-install-files.ts's installer rollback restore(), which calls
terminateScheduledTaskGatewayListeners(env) directly.

Widen terminateGatewayProcessTree's assertCurrent callback to accept
an async function and await it, then route this one recheck through
the existing retryScheduledTaskLeaseRead helper instead of adding a
separate retry policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

1 participant