Repository navigation
fix(daemon): restart Windows gateways with redirected launcher output - #137374
Conversation
…ws launcher command Fixes openclaw#137362 Co-Authored-By: Claude Code <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 6:06 PM ET / 22:06 UTC (Revision 10). ClawSweeper reviewWhat this changesThe PR recognizes complete trailing Windows launcher redirections, preserves ambiguous commands, and adds stop/restart regressions and quoting guidance. Merge readiness✅ Ready for maintainer review The PR remains necessary for legacy Windows launcher ownership checks. The prior expansion defect is fixed, native proof covers the relevant termination boundary, and the recorded narrow upgrade-proof exception satisfies the previous review’s remaining request. No actionable findings remain. Priority: P2 Review scores
Verification
How this fits togetherWindows Gateway lifecycle commands read the installed launcher to identify processes they may stop. This parser separates shell redirection from process arguments before ownership checks authorize termination and restart. flowchart TD
A[Installed Windows launcher] --> B[Validate trailing redirections]
B --> C[Process arguments]
D[Live Windows process information] --> E[Verify process ownership]
C --> E
E --> F[Terminate owned process and restart]
E --> G[Refuse unverified process with guidance]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +97, Tests +428, Docs +7. Total +532 across 7 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep redirection normalization in the launcher owner while preserving exact legacy-process matching and current main’s live-owner safeguards. Do we have a high-confidence way to reproduce the issue? Yes: a redirected launcher without a published live-owner record reaches current main’s exact-argument fallback with shell tokens still included. Source establishes that mismatch; this read-only review did not execute a new reproduction. Is this the best way to solve the issue? Yes: repairing the launcher reader preserves the existing ownership boundary, and the native fixture demonstrates both refusal and authorized termination. The documented narrow exception resolves the previously requested upgrade qualification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against efc3b02d3ed3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Normalize complete trailing launcher redirections at the parser boundary. Leave compound commands, malformed suffixes, escaped quotes/operators, ambiguous handle digits, and unquoted filename delimiters unchanged. Keep exact process ownership, environment handling, and executable selection. Integrate the contributor fix with current main to retain effective service inspection and the existing native Windows CI route. Add reader and lifecycle regressions plus real cmd.exe/CIM proof without changing workflows. Fixes openclaw#137362 Co-authored-by: akagifreeez <[email protected]>
Security-sensitive guard clearedThis PR no longer has blocked security-sensitive file changes. A future security-sensitive change requires a fresh
|
|
Maintainer review at One P1 before this can land: Reject unresolved expansions before stripping redirection targets — Two notes: the Dependency Guard comment above compared against a stale base — your diff contains no lockfile or dependency changes, so nothing to do there. And the branch is maintainer-editable, so if you prefer, say so and we will push the fix under your credit; otherwise the next round runs on your next push and we land it right after. |
|
Round 2 at |
Preserve launch lines with unquoted percent or delayed-expansion targets instead of shortening the arguments used for process ownership. Explain how to quote a redirect target when stop or restart cannot verify a listener. Cover reader and stop/restart refusal with a regression that previously selected a different same-port process for taskkill. Extend native Windows proof to cover actual termination, nonmatching-process survival, and restart. Windows Scheduled Task launchers with quoted output redirection keep their exact process ownership checks. Thanks @akagifreeez (openclaw#137374). Fixes openclaw#137362.
|
@steipete, honoring your request to hold further pushes. The separate Linux CI fixture repair landed in #147398 as Our Windows upgrade cell tested package Candidate activation, retained-launcher handoff, and post-upgrade ownership/restart remain unproven. Guest cleanup failed to stop one recorded process; verified VM teardown completed containment at 21:11:28 UTC on September 13, 2026. No new retry from this lane is planned, and this is not a claim that bf55 tests or exact-head CI passed. Leaving the PR body, branch, and landing with you. |
Keep the stop/restart test file within the line limit when merged with current main. Retain both refusal regressions in a focused file using the existing daemon fixtures; no production behavior or lint threshold changes.
|
Merged via squash.
|
…openclaw#137374) Windows Scheduled Task installs whose launcher line carries output redirection now restart correctly. Parse validated trailing CMD redirections at the launcher writer/reader boundary while preserving quoted arguments and rejecting ambiguous unquoted environment expansions as shortened ownership evidence. Keep exact process ownership checks. Add a quoting hint to refusal diagnostics and regression coverage for reader behavior, stop/restart refusal, real CMD/CIM expansion, nonmatching-process survival, authorized termination, and replacement startup. Validation: focused daemon tests and changed checks pass; P1 review is scoped-clean; exact-head CI is green, including 92 Windows daemon-shard passes and all six native fixture tests. Lead-approved narrow proof exception: the released 2026.9.3 updater failed before candidate activation at its 30-second baseline fingerprint cap (package-update-integrity.ts:14,46-50), the known openclaw#144712 class fixed on main by openclaw#144925 and openclaw#145219. The failed cell remains recorded in the PR; current main's driver is not affected by that released cap. Thanks @akagifreeez (openclaw#137374). Fixes openclaw#137362. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: akagifreeez <[email protected]>
Fixes #137362
What Problem This Solves
Appending output redirection to a Windows Gateway launcher makes stop/restart reject its own listener because CMD redirection syntax is parsed as process arguments. The remaining review finding also allowed an unquoted environment expansion to produce shortened arguments that could match a different process.
User Impact
Windows Scheduled Task installs whose launcher line carries complete, quoted output redirection can restart with exact process ownership checks. Ambiguous commands, including unquoted redirect-target expansions, remain intact and cannot authorize a listener using shortened arguments. The ownership-refusal diagnostic explains how to quote the entire redirect target.
Why This Change Was Made
The launcher reader and writer keep one CMD grammar owner. The scanner removes only a fully validated trailing redirection suffix; process ownership comparison and termination policy remain unchanged. Documentation explains the quoting requirement.
The contributor's commits remain in the branch ancestry, followed by a separate maintainer repair commit. Thanks @akagifreeez (#137374).
Evidence
Current candidate:
f8f201dc100fb91fb31b54034e4fa4bb8d4f8953. Its parentbf55d658a65589cb1c0e8769fc979f7143d61a09has identical production/package inputs; the final commit only moves two regressions into a focused test file.4b172a80b694a30e53a96ffca5925ae6db46b3cb: the reader removed percent/bang expansion suffixes, and both production stop/restart paths selected synthetic PID 6262 fortaskkill(expected [6262] to deeply equal []).node scripts/run-vitest.mjs src/daemon/schtasks.test.ts src/daemon/schtasks.stop.test.ts src/daemon/schtasks.redirect-stop.test.ts src/daemon/schtasks.env-case.real.test.tspassed: 143 passed, 5 Windows-only cases skipped on macOS. The requestedschtasks-layout.test.tsdoes not exist; reader coverage is inschtasks.test.ts.pnpm check:changedpassed, including core/test types, targeted lint, formatting, dead-export scans, and repository guards.git diff --checkpassed.schtasks.env-case.real.test.tsexecuted without skips: four real CMD/CIM cases and two environment controls. The quoted-target case exercised production termination refusal for a live process with shortened arguments, allowed termination after restoring the quoted launcher, and replacement startup. The unquoted-expansion case also passed against real CMD/CIM. The daemon shard recorded 92 passes with no skips.The first candidate's CI lint job found that the merge tree pushed
schtasks.stop.test.tsto 1,025 counted lines. The final test-only commit moves the new cases toschtasks.redirect-stop.test.ts, preserves their assertions, and leaves the lint threshold unchanged. Both relocated lifecycle cases and both reader cases were re-proved failing with only the expansion guard removed, then passing after exact source restoration. Changed checks and fresh P1 review passed again. Final-head CI is green forf8f201dc100fb91fb31b54034e4fa4bb8d4f8953.Published updater result and approved proof exception
The real Windows cell ran the installed published
2026.9.3driver (1391f7cd2d40ab5bbcf2f5f831d3a64f520e72d7) against the packedbf55d658a65589cb1c0e8769fc979f7143d61a09candidate. The tarball SHA-256 wasb7b893bf9bc9ca7b3918a0a1b3567804c61527fc2deed9bee0fe89027958121c. It used a new canonical named profile, isolated npm prefix, task-local Node 24.16.0, a unique Scheduled Task/port, and the baseline-generated supervisor launcher with quoted%TEMP%output redirection to a path containing spaces. The original Gateway was ready immediately before update; no pre-stop or--no-restartwas used.Package staging and all six candidate checks passed: migration rehearsal, Doctor lint, config validation, plugin resolution, migration continuation, and Gateway canary. Activation failed at
global install swapafter 30,008 ms:Package rollback verification timed out, followed byPackage rollback verification failed: retained package tree changed.The published driver's integrity reader caps the scan at 30 seconds despite the larger update timeout. The baseline scan precedes service stop; without a captured fingerprint, the recovery check reports “changed.” That message does not itself establish corruption. The old installed version, PID, readiness, launcher hash, and redirect remained unchanged. No candidate activation or restart was claimed, and no recovery behavior or timeout was changed to bypass the failure.
Approved narrow proof exception (lead ruling): the failed cell belongs to the known #144712 class in the released
2026.9.3driver, before candidate activation or Scheduled Task cleanup. Itssrc/infra/package-update-integrity.ts:14,46–50caps baseline fingerprinting at 30 seconds. The result cannot evaluate this PR's launch-line parser or cleanup behavior. The class was fixed on main by #144925 (ce6718fd82a492b7c1f2b068e1c68477fd9a8b7f) and #145219 (290613f538dddfae9a90720c4ad559a2a5b330cf): the five-minute fingerprint fix and subsequent measured-budget work remove the released 30-second ceiling while the old Gateway keeps serving. Current main's driver is not affected by that ceiling.The lead explicitly accepts the exact-head Windows CI (92 daemon-shard passes, all six native fixture tests), native proof of nonmatching-process survival, authorized termination and replacement startup, and the scoped-clean P1 review as the landing evidence for #137374. The exception resolves the remaining ClawSweeper proof/maintainer-decision moves. It does not claim that the failed cell activated the candidate, waive unrelated gates, or establish an older unsupervised-launcher update path. Contributor ancestry and credit remain preserved.
Release-note context: Windows Scheduled Task installs whose launcher line carries output redirection now restart correctly. Thanks @akagifreeez (#137374). Fixes #137362.
During isolated fixture cleanup, the old published CLI also reproduced the original bug:
gateway stop --force --jsonended the task but refused its surviving listener because ownership could not be verified from the redirected launcher. That result is separate from the updater failure. Exact-owned native termination was used only for teardown. The fixture task/processes/profile/prefix/runtime/cache were removed, the default installation was preserved, and the Windows guest was stopped without restoring a snapshot.