Skip to content

fix(windows): remove findstr from restart probe#101366

Merged
steipete merged 3 commits into
mainfrom
codex/fix-windows-restart-probe
Jul 7, 2026
Merged

fix(windows): remove findstr from restart probe#101366
steipete merged 3 commits into
mainfrom
codex/fix-windows-restart-probe

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closes #84600
Related: #91273

What Problem This Solves

Fixes an issue where Windows Gateway restart handoff could leave a visible or hung cmd.exe / findstr.exe process while checking whether the scheduled task was already running. Reports show the probe delaying restart for minutes and sometimes requiring manual recovery.

Why This Change Was Made

The generated restart helper now asks PowerShell to exit 0 only when Get-ScheduledTask reports Running, and exits 1 otherwise. The existing batch errorlevel branch therefore keeps the same retry/fallback behavior without starting findstr; single-quoted PowerShell literals avoid nested escaped double quotes and preserve apostrophes in custom task names.

This is a maintainer replacement for #91273 because the contributor branch predates substantial current-main Windows restart hardening. The useful fix is preserved with co-author credit and applied on top of the current getWindowsCmdExePath() behavior.

User Impact

Windows Gateway restarts no longer spawn the findstr subprocess implicated in visible black windows and hung restart handoffs. Existing task-state detection, retry limits, fallback startup, cleanup, and hidden detached launch behavior remain in place.

Evidence

  • Current source and shipped v2026.6.11 contain the reported PowerShell-to-findstr pipeline in src/infra/windows-task-restart.ts.
  • Focused regression coverage asserts the PowerShell-only exit-code probe, no findstr, ordering before schtasks /Run, and apostrophe-safe task names.
  • Exact code head 6326ad97f0a62b56e9426db05d5631d732c0daeb passed the full hosted CI run, including all 6 focused src/infra/windows-task-restart.test.ts cases: https://github.com/openclaw/openclaw/actions/runs/28842342161
  • Native Windows Server 2025 run 28843194826 on fdeb981ba8549324ff3c699768a8dfcbcf7016f5 passed 8 Windows CI shards (180 tests passed, 17 skipped). Final head 372e75b52199d3a2db24d144025fc60b8fe355f5 removes only the release-owned changelog line and restores the exact code tree from 6326ad97f0a62b56e9426db05d5631d732c0daeb: https://github.com/openclaw/openclaw/actions/runs/28843194826
  • Fresh Codex autoreview on the final current-main diff reported no accepted/actionable findings (confidence 0.82).
  • Direct AWS native-Windows Task Scheduler proof was attempted twice on Crabbox lease cbx_94ba7fc425c8, but the fresh image never completed SSH bootstrap; the lease was stopped. No behavior claim relies on that blocked run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 7, 2026, 1:18 AM ET / 05:18 UTC.

Summary
The branch replaces the Windows scheduled-task restart helper's PowerShell-to-findstr probe with a PowerShell exit-code probe, updates focused generated-script tests, and adds a changelog line.

PR surface: Source +2, Tests +2, Docs +1. Total +5 across 3 files.

Reproducibility: yes. source-reproducible: current main still generates the exact PowerShell-to-findstr helper line reported, and the Windows restart path reaches that helper. I did not run a live Windows Task Scheduler repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Windows restart probe: 1 runtime task-state probe changed. This is the live Windows restart decision point, so generated-script assertions alone do not prove windowing and restart behavior on a real host.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Post redacted exact-head Windows Task Scheduler proof showing no cmd/findstr process or window and a successful Gateway restart.
  • Remove the CHANGELOG.md line and keep the release-note context in the PR body or squash message.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body says exact-head native Windows proof will be added before merge, but no linked screenshot, terminal output, recording, logs, or validation artifact is present yet; redact private details before posting proof. 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.

Risk before merge

  • [P1] No exact-head native Windows Task Scheduler proof is present yet, so the no-window/no-hang behavior and successful restart handoff remain unproven outside generated-script inspection.
  • [P1] The PR changes the helper's live task-state exit-code decision point; if PowerShell quoting or Scheduled Task state behavior differs on a real host, Windows restart handoff availability could regress.

Maintainer options:

  1. Require Windows restart proof (recommended)
    Before merge, attach redacted proof from a real Windows Task Scheduler restart showing no findstr process/window and successful Gateway recovery.
  2. Accept source-only availability risk
    Maintainers may intentionally land the narrow generated-script change without live proof, but they would own any unproven Windows restart failure mode.

Next step before merge

  • [P1] The remaining blockers are proof sufficiency and protected-label merge handling, not an automated code repair lane.

Maintainer decision needed

  • Question: Should this protected Windows restart PR wait for native Windows Task Scheduler proof before merge, or should maintainers explicitly override the proof gate for the source/test-only fix?
  • Rationale: The code path affects Windows restart availability, and the PR body says native proof will be added, but source review cannot prove the reported no-window/no-hang behavior on a real host.
  • Likely owner: steipete — The PR is a maintainer replacement authored by steipete, who also has recent adjacent Windows restart logging history.
  • Options:
    • Wait for native proof (recommended): Require redacted Windows Task Scheduler, terminal, desktop, or log proof that the helper completes without findstr and the Gateway restarts successfully.
    • Override source-only risk: A maintainer can intentionally accept the source/test evidence without live Windows proof, owning any unproven restart or windowing behavior.

Security
Cleared: The diff changes existing Windows command generation plus tests and release-note text, with no new dependencies, workflows, secrets, permissions, package scripts, or supply-chain surface.

Review findings

  • [P3] Remove the changelog edit from this PR — CHANGELOG.md:26
Review details

Best possible solution:

Merge the source/test fix without the CHANGELOG.md change after exact-head Windows proof shows no cmd/findstr window, correct Running detection, and a successful Gateway restart.

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

Yes, source-reproducible: current main still generates the exact PowerShell-to-findstr helper line reported, and the Windows restart path reaches that helper. I did not run a live Windows Task Scheduler repro in this read-only review.

Is this the best way to solve the issue?

Yes for the runtime fix: moving the Running check into PowerShell exit codes is the narrowest maintainable way to remove findstr while preserving retry, cleanup, and fallback shape. The PR should still drop the release-owned changelog edit and add native Windows proof before merge.

Full review comments:

  • [P3] Remove the changelog edit from this PR — CHANGELOG.md:26
    CHANGELOG.md is release-owned in the root repository policy, and normal fix PRs should keep release-note context in the PR body or squash message instead. Please drop this added line so release generation owns the final entry and this branch avoids release-note churn.
    Confidence: 0.94

Overall correctness: patch is correct
Overall confidence: 0.82

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a bounded Windows Gateway restart reliability fix with a platform-limited blast radius.
  • add merge-risk: 🚨 availability: The PR changes the Windows restart helper's task-state decision path, where a bad exit code or quoting result could leave restart handoff unreliable.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body says exact-head native Windows proof will be added before merge, but no linked screenshot, terminal output, recording, logs, or validation artifact is present yet; redact private details before posting proof. 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.

Label justifications:

  • P2: This is a bounded Windows Gateway restart reliability fix with a platform-limited blast radius.
  • merge-risk: 🚨 availability: The PR changes the Windows restart helper's task-state decision path, where a bad exit code or quoting result could leave restart handoff unreliable.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body says exact-head native Windows proof will be added before merge, but no linked screenshot, terminal output, recording, logs, or validation artifact is present yet; redact private details before posting proof. 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

PR surface:

Source +2, Tests +2, Docs +1. Total +5 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 4 +2
Tests 1 4 2 +2
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 11 6 +5

What I checked:

Likely related people:

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@steipete steipete self-assigned this Jul 7, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer proof for final head 372e75b52199d3a2db24d144025fc60b8fe355f5:

The fix is a direct PowerShell task-state exit code. It removes findstr.exe while retaining the existing errorlevel, retry, schtasks /Run, fallback, logging, cleanup, and hidden detached-launch behavior. Regression coverage asserts the exact emitted command, no findstr, branch ordering, and apostrophe-safe task names.

Proof gap: a direct Ready/Running Task Scheduler scenario was attempted twice on fresh AWS Windows Crabbox lease cbx_94ba7fc425c8, but SSH authentication bootstrap never completed. The lease was released; no success claim relies on that run.

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 7, 2026
@steipete
steipete merged commit 3a482a7 into main Jul 7, 2026
107 of 108 checks passed
@steipete
steipete deleted the codex/fix-windows-restart-probe branch July 7, 2026 05:29
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
* fix(windows): remove findstr from restart probe

Co-authored-by: Deepak Jain <[email protected]>

* docs(changelog): note Windows restart probe fix

* docs(changelog): defer release note

---------

Co-authored-by: Deepak Jain <[email protected]>
sheyanmin pushed a commit to sheyanmin/openclaw that referenced this pull request Jul 8, 2026
* fix(windows): remove findstr from restart probe

Co-authored-by: Deepak Jain <[email protected]>

* docs(changelog): note Windows restart probe fix

* docs(changelog): defer release note

---------

Co-authored-by: Deepak Jain <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
* fix(windows): remove findstr from restart probe

Co-authored-by: Deepak Jain <[email protected]>

* docs(changelog): note Windows restart probe fix

* docs(changelog): defer release note

---------

Co-authored-by: Deepak Jain <[email protected]>
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
* fix(windows): remove findstr from restart probe

Co-authored-by: Deepak Jain <[email protected]>

* docs(changelog): note Windows restart probe fix

* docs(changelog): defer release note

---------

Co-authored-by: Deepak Jain <[email protected]>
(cherry picked from commit 3a482a7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Windows heartbeat cmd window not hidden - 'findstr /I /C:"Running"' stays visible

1 participant