Skip to content

/restart command fails on Windows: triggerOpenClawRestart() missing schtasks support #29949

@jasonsmith4899

Description

@jasonsmith4899

Bug

The /restart\ Telegram (and other channel) command fails on Windows because \ riggerOpenClawRestart()\ does not implement Windows scheduled task restart.

Expected behavior

/restart\ should restart the gateway on Windows via \schtasks /End\ + \schtasks /Run, similar to how \openclaw gateway restart\ (CLI) works through
estartScheduledTask().

Actual behavior

\ riggerOpenClawRestart()\ only handles:

  • macOS: \launchctl kickstart -k\
  • Linux: \systemctl restart\
  • Windows: returns { ok: false, method: 'supervisor', detail: 'unsupported platform restart' }\

The gateway process gets stopped (via SIGUSR1 or the in-process path), but never restarted on Windows.

Relevant code

In \handleRestartCommand, when no SIGUSR1 listener is present, it calls \ riggerOpenClawRestart()\ as fallback.

\ riggerOpenClawRestart():

\\js
if (process.platform !== 'darwin') {
if (process.platform === 'linux') {
// systemctl restart ... (implemented)
}
// Windows falls through here:
return { ok: false, method: 'supervisor', detail: 'unsupported platform restart' };
}
// macOS launchctl (implemented)
\\

Meanwhile,
estartScheduledTask()\ in \src/daemon/schtasks.ts\ already has the correct Windows implementation:

\\js
async function restartScheduledTask({ stdout, env }) {
const taskName = resolveTaskName(env);
await execSchtasks(['/End', '/TN', taskName]);
const res = await execSchtasks(['/Run', '/TN', taskName]);
// ...
}
\\

Suggested fix

Add a \win32\ branch in \ riggerOpenClawRestart()\ that calls \schtasks /End\ + \schtasks /Run\ (or reuses
estartScheduledTask\ logic).

Workaround

Use \openclaw gateway restart\ from CLI instead of /restart\ in chat.

Environment

  • OS: Windows 10 (10.0.26100)
  • OpenClaw: latest (npm)
  • Channel: Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions