Skip to content

fix(update): honor the update budget when probing the Windows Scheduled Task - #143292

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-win-task-probe
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-win-task-probe

Conversation

@steipete

@steipete steipete commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #143210

Additional instructions

Maintainers can update this branch in the OpenClaw repository.

What Problem This Solves

Fixes an issue where Windows users running openclaw update would be refused at managed-service-preflight when the Scheduled Task runtime probe exceeded five seconds, even though the update allowed a longer timeout. The refusal hid the timeout behind generic service-access guidance.

Why This Change Was Made

The Windows runtime reader now forwards the caller's timeout to the Scheduled Task probe, and the probe honors it instead of applying a hidden five-second ceiling. Calls without a valid positive finite budget retain the five-second default. Update entry points already pass their existing per-step budget.

An actual ETIMEDOUT carries structured timeout metadata into service inspection. Update preflight retries that inspection once, rereading the service definition and runtime before deciding ownership. Repeated timeouts still prevent mutation and report the enforced budget, including when revalidating previously admitted ownership. Other probe failures remain fail-closed without a retry. Only fixed timeout text and the numeric budget reach the refusal; arbitrary native error text is not added.

User Impact

Slow Windows Scheduled Task queries can use the update's requested budget and recover from one timeout. A repeated timeout now explains why the update stopped. Each attempt receives the existing update step budget (--timeout, default 1800 seconds), so two hung probes can consume twice that allowance. Status calls also receive the timeout they already request; the probe itself does not retry.

Evidence

Regression tests were run against the unchanged production implementation by temporarily reversing only the production patch, then restoring it byte-for-byte. Before the fix:

Scheduled Task probe: expected 30000 ms, received 5000 ms
One ETIMEDOUT then success: expected owned, received unavailable
Two ETIMEDOUTs: refusal omitted the timeout and budget
Previously admitted service: refusal replaced timeout with ownership-changed text
Probe suite: 6 failed
Preflight suite: 4 failed, 24 passed

Post-fix validation: 282 tests passed across six files (three routed Vitest shards):

node scripts/run-vitest.mjs src/daemon/schtasks-state-probe.test.ts src/daemon/schtasks.test.ts src/daemon/service.test.ts src/cli/update-cli/update-command-service-maintenance.test.ts src/cli/update-cli/update-command-service.integration.test.ts src/cli/update-cli/update-command-migrated-windows.test.ts

The suite covers the actual Windows runtime reader and update preflight with mocked spawnSync, including one-time timeout recovery, repeated-timeout refusal, preservation of timeout diagnostics after admission, and non-timeout refusal without retry. Existing numeric-state, ownership, activation, and recovery tests also pass.

The final node scripts/check-changed.mjs gate passed (including production/test typechecking, formatting, lint, and architecture guards), with a separate Vitest filesystem cache for the concurrent check process. git diff --check passed. The preflight suite passed all 28 tests again after a test-only lint cleanup.

Exact-head CI passed: run 34383681387, head 5488b201bae96f14fd732dfc03920e3e52de493a. The bounded PR watcher completed with GREEN and zero pending checks; both Windows Node test shards completed successfully.

Known gaps: the tests exercise real runtime/preflight code with mocked Windows subprocess responses on macOS. No live Windows 11, PowerShell COM, antivirus-latency, or end-to-end package update proof was run. The separate missing-launcher existence-probe error path is outside this runtime-probe repair.

Thanks to @fanyuantaier for the detailed report and measurements.

Review notes

No persisted state, install records, or config schema changes. Both Windows Node CI shards executed their suites natively on Windows and passed in run 34383681387. The probe timeout path uses Node's documented spawnSync timeout and ETIMEDOUT contract; the focused regressions mock subprocess results. A live antivirus-latency reproduction is unavailable, and native PowerShell latency/termination was not independently demonstrated. The maintainer accepts this disclosed validation limit for the bounded timeout repair; this is not a claim of live Windows update proof.

The ten regression cases cover omitted, zero, negative, infinite, 200 ms, and 30000 ms probe budgets; one timeout followed by success; two timeouts; two timeouts after prior ownership admission; and an ENOENT failure without retry. Fresh ownership checks and refusal on an unverifiable service remain enforced.

@clawsweeper

clawsweeper Bot commented Sep 9, 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.

@steipete
steipete marked this pull request as ready for review September 9, 2026 17:33
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 9, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 2:07 PM ET / 18:07 UTC (Revision 2).

ClawSweeper review

What this changes

Windows update preflight honors the existing timeout setting, retries one timed-out Scheduled Task inspection, and reports the enforced budget when inspection still fails.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary: current main and the latest release retain the timeout defect. No blocking patch defect was found, and the updated maintainer discussion resolves the prior review’s optional native-proof concern.

Priority: P0
Reviewed head: 5488b201bae96f14fd732dfc03920e3e52de493a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, verified CI, preserved safety checks, and an explicitly accepted native-validation limitation.
Proof confidence 🌊 off-meta tidepool Not applicable: This verified maintainer PR is exempt from the external-contributor proof gate. Its tests exercise the actual Windows runtime reader and update preflight with mocked subprocess responses; live PowerShell latency and termination remain unverified, explicitly disclosed, and accepted in the updated review notes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This verified maintainer PR is exempt from the external-contributor proof gate. Its tests exercise the actual Windows runtime reader and update preflight with mocked subprocess responses; live PowerShell latency and termination remain unverified, explicitly disclosed, and accepted in the updated review notes.
Evidence reviewed 10 items Current main still contains the defect: The fetched main probe caps caller timeouts at 5,000 ms; its Windows runtime reader also invokes the probe without forwarding the caller budget.
Latest release remains affected: The latest-release endpoint identifies v2026.9.3, and inspection of that tag confirms the same five-second ceiling.
Retry retains fresh ownership checks: The timeout retry calls the complete service-state reader again, including definition and environment validation, before the existing ownership and admission checks. Repeated unknown state remains unavailable; subsequent stop preparation retains its own revalidation.
Findings None None.
Security None None.

How this fits together

Before changing installed code, OpenClaw’s updater inspects the Gateway’s managed service and verifies ownership. On Windows, a PowerShell Task Scheduler query supplies runtime state that determines whether update preparation can proceed.

flowchart TD
  A[Update request and timeout] --> B[Read service definition]
  B --> C[Probe Windows Scheduled Task]
  C --> D{Probe timed out?}
  D -->|Once| B
  D -->|Success| E[Validate current ownership]
  D -->|Repeated timeout| F[Refuse update with budget]
  E --> G[Proceed or refuse safely]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +119, Docs +2. Total +162 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 52 11 +41
Tests 2 119 0 +119
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 173 11 +162

Review metrics

Metric Value Why it matters
Maximum probe allowance 2 attempts × 1800 seconds by default Two hung probes can consume one hour before refusal, a tradeoff explicitly disclosed in the PR.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #143210
Summary: This PR is the explicit candidate fix for the reported Scheduled Task timeout-to-update-refusal path.

Members:

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

Technical review

Best possible solution:

Use the existing update timeout consistently while retaining fresh service ownership checks and explicit timeout refusals.

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

Yes, at the source level: a Windows runtime probe exceeding five seconds becomes unknown and blocks update despite a larger requested budget. The reporter supplies real-machine measurements; this review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. Forwarding the existing budget repairs the responsible boundary without introducing another setting, and the single retry preserves ownership validation and refusal semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9865df7610c8.

Labels

Label justifications:

  • P0: The linked report establishes a blocked normal update path whose demonstrated recovery required editing installed code.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This verified maintainer PR is exempt from the external-contributor proof gate. Its tests exercise the actual Windows runtime reader and update preflight with mocked subprocess responses; live PowerShell latency and termination remain unverified, explicitly disclosed, and accepted in the updated review notes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Matias Schimuneck: 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 (1 earlier review cycle)
  • reviewed 2026-09-09T17:40:26.850Z sha 5488b20 :: blocked before merge. :: none

@steipete
steipete merged commit 87b7cad into main Sep 9, 2026
261 checks passed
@steipete
steipete deleted the steipete/upd-win-task-probe branch September 9, 2026 18:09
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
steipete added a commit that referenced this pull request Sep 13, 2026
…ed literals (#145219)

Derive update inspection, candidate startup, activation, and finalization allowances from measured SQLite state, observed startup, plugin count, and the caller's step budget. Forward the owning allowance through service commands, readiness, Doctor, and migrated finalization instead of imposing competing short cutoffs. Keep metadata and progress probes cancellable in child processes.

Preserve update-activation-timeout settlement, integrity checks, live authority, and unsettled-writer ownership. Expiry alone never authorizes rollback, restart, or lease release. Installer network operations share the documented allowance. No new configuration, dependencies, schema, retries, or persistent retention/recovery semantics.

The activation regression failed with the original resolver and passed with the repair; focused proof passed 102 tests in six files. Native POSIX FIFO cancellation and Chrome boundary proof are recorded in the PR. CI 34767727811 passed 129 jobs with 11 skips on a verified current-base merge checkout. The final refresh commit is tree-identical to the reviewed source.

The maintainer accepts longer recovery waits and the incomplete slow-state published-driver/native Windows recovery qualification. An already-installed driver retains its loaded timers; containing-release delivery and reporter recovery remain unverified.

Reported by @rlosito (#146637); the initiating timeout cause remains unproved. Related update-timeout reports are tracked in #145252.

Refs #144758 #144901 #144890 #143292 #146637 #145252. Preserves the activation boundary from #147019.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…ed literals (openclaw#145219)

Derive update inspection, candidate startup, activation, and finalization allowances from measured SQLite state, observed startup, plugin count, and the caller's step budget. Forward the owning allowance through service commands, readiness, Doctor, and migrated finalization instead of imposing competing short cutoffs. Keep metadata and progress probes cancellable in child processes.

Preserve update-activation-timeout settlement, integrity checks, live authority, and unsettled-writer ownership. Expiry alone never authorizes rollback, restart, or lease release. Installer network operations share the documented allowance. No new configuration, dependencies, schema, retries, or persistent retention/recovery semantics.

The activation regression failed with the original resolver and passed with the repair; focused proof passed 102 tests in six files. Native POSIX FIFO cancellation and Chrome boundary proof are recorded in the PR. CI 34767727811 passed 129 jobs with 11 skips on a verified current-base merge checkout. The final refresh commit is tree-identical to the reviewed source.

The maintainer accepts longer recovery waits and the incomplete slow-state published-driver/native Windows recovery qualification. An already-installed driver retains its loaded timers; containing-release delivery and reporter recovery remain unverified.

Reported by @rlosito (openclaw#146637); the initiating timeout cause remains unproved. Related update-timeout reports are tracked in openclaw#145252.

Refs openclaw#144758 openclaw#144901 openclaw#144890 openclaw#143292 openclaw#146637 openclaw#145252. Preserves the activation boundary from openclaw#147019.
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 gateway Gateway runtime maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Windows] openclaw update aborts with managed-service-preflight because the Scheduled Task runtime probe exceeds its hard-coded 5s timeout

1 participant