Skip to content

fix: Windows /restart falls back to in-process restart without changing PID #95072

Description

@samson1357924

Problem

On Windows (without Scheduled Task supervisor), the /restart command completes successfully in the UI but the gateway process is never actually restarted. The PID and uptime remain unchanged.

Root Cause

restartGatewayProcessWithFreshPid() in src/infra/process-respawn.ts unconditionally returns mode: "disabled" on Windows when no Scheduled Task markers are detected:

if (process.platform === "win32") {
  return {
    mode: "disabled",
    detail: "win32: detached respawn unsupported without Scheduled Task markers",
  };
}

This causes the run-loop to fall back to in-process restart (close HTTP server + reopen), which does not actually restart the Node.js process.

However, respawnGatewayProcessForUpdate() (the update restart path) does attempt detached respawn on Windows without this restriction.

Expected Behavior

/restart should actually restart the gateway process on Windows, matching the behavior on macOS/Linux.

Reproduction

  1. Run OpenClaw gateway on Windows without a Scheduled Task
  2. Send /restart from any channel (Telegram, Discord, etc.)
  3. Gateway reports restart completed
  4. Run /status — uptime is unchanged, PID is the same

Log Evidence

[gateway] signal SIGUSR1 received
[gateway] received SIGUSR1; restarting
[shutdown] started: gateway restarting
[shutdown] completed cleanly in 517ms
[gateway] restart mode: in-process restart (win32: detached respawn unsupported without Scheduled Task markers)

Proposed Fix

In restartGatewayProcessWithFreshPid(), replace the Windows "disabled" return with a detached spawn attempt (same pattern as respawnGatewayProcessForUpdate()), falling back to "failed" on error so the run-loop can attempt supervisor or in-process restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions