Skip to content

fix(windows): preserve gateway restart CLI during Scheduled Task handoff - #120230

Closed
clawsweeper[bot] wants to merge 1 commit into
mainfrom
clawsweeper/issue-openclaw-openclaw-120134
Closed

clawsweeper[bot] wants to merge 1 commit into
mainfrom
clawsweeper/issue-openclaw-openclaw-120134

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #120134.

Windows Scheduled Task restart now records ParentProcessId in the verified gateway-process snapshot and uses a bounded ancestor walk to recognize the directly observed gateway-owned invoking CLI. After schtasks /End, that one path omits taskkill /T, waits for listener release, then invokes /Run; ordinary external callers retain verified tree cleanup. A still-busy port remains a visible failure and does not proceed to relaunch.

Tests cover a verified descendant, a non-descendant retaining tree cleanup, and a descendant path whose port does not release. Windows lifecycle proof must run restart from a gateway-owned exec child and show port release followed by task relaunch.

Credit: thanks @w1130150306 for the report and reproduction in #120134.

Release-note context: Windows Scheduled Task gateway restart no longer kills its own gateway-owned CLI before relaunch.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge labels Aug 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Aug 7, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: the merged current-main repair uses the Gateway-owned safe restart path and the supplied native Windows evidence shows this PR’s cleanup-skipping approach still fails to relaunch the Gateway.

Canonical path: Keep the merged Gateway-owned safe restart routing from #134549 and retire this lower-level Scheduled Task workaround.

So I’m closing this here and keeping the remaining discussion on #134549.

Review details

Best possible solution:

Keep the merged Gateway-owned safe restart routing from #134549 and retire this lower-level Scheduled Task workaround.

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

Yes: the supplied native Windows run on this exact head exercised a gateway-descended restart and observed the PR preserve the CLI but fail visibly before relaunch.

Is this the best way to solve the issue?

No: routing the Windows Gateway-service command into the existing safe Gateway-owned restart path is the better owner boundary, and that repair is already merged.

Security review:

Security review cleared: The diff changes local Windows process lifecycle logic and introduces no concrete security or supply-chain concern.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • nerclid: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Codex review notes: model internal, reasoning high; reviewed against a68a4e396841; fix evidence: commit 3a0a62371811, main fix timestamp 2026-09-02T00:55:17Z.

@clawsweeper clawsweeper Bot added the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Resolve merge risk (P1) - No supplied artifact exercises a real Windows gateway-owned exec child through task end, listener release, and Scheduled Task relaunch; the focused tests simulate that lifecycle. (sha=d4b40a7f32aa597302c7c7852e3db1109c36e33f)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed 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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 15, 2026
@nerclid

nerclid commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Evidence

Tested PR head d4b40a7f32aa597302c7c7852e3db1109c36e33f replayed onto main snapshot 3b92e84d293404d7a48f88c9ebeb4b66c72fe2f5.

Prepared-snapshot validation:

  • schtasks.stop: 33/33 passed
  • schtasks.startup-fallback: 75/75 passed
  • Package build and integrity checks passed
  • Native guest: Windows Hyper-V VM, Node.js 24.18.1

A real model-backed Gateway agent invoked:

openclaw.cmd gateway restart --json

Verified process ancestry was:

Gateway PID 604
  powershell.exe PID 4928
    cmd.exe PID 9964
      restart CLI PID 3504

Observed behavior:

  • The Gateway-descended restart controller survived.
  • schtasks /End returned exit code 0.
  • Gateway PID 604 continued owning port 18789 through all 961 state samples.
  • No taskkill or schtasks /Run was observed.
  • The existing Gateway remained healthy.
  • No successor Gateway generation was created.
  • The restart controller exited with:
Gateway restart failed: Error: gateway port 18789 is still busy before restart; remaining listener ownership could not be verified

Sysmon, WMI lifecycle events, Windows Security auditing, Scheduler state, TCP sampling, and before/after health checks agreed on this result.

This reports the observed native behavior only and does not prescribe an implementation change.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. 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. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper recorded closeout evidence for this proposed close.

@clawsweeper clawsweeper Bot closed this Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

🦞👀
ClawSweeper could not autoclose this item.

Reason: structured ClawSweeper close marker: close-required (sha=d4b40a7f32aa597302c7c7852e3db1109c36e33f)

Usage: /autoclose <maintainer close reason>. I will close this item and any open same-repo items explicitly referenced in the command text.

@RomneyDa
RomneyDa deleted the clawsweeper/issue-openclaw-openclaw-120134 branch October 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:human-review Needs maintainer review before ClawSweeper can continue clawsweeper Tracked by ClawSweeper automation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 'openclaw gateway restart' run via agent exec kills the CLI itself on Windows (taskkill /T terminates child process), leaving the gateway stopped

1 participant