← Back to PRs

#5077: fix(windows): implement reliable gateway restart via schtasks helper

by romeoscript open 2026-01-31 01:32 View on GitHub →
fixes #5065 Updated /restart command to skip unreliable SIGUSR1 signals on Windows, forcing a full process restart instead. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR changes `/restart` handling to avoid in-process `SIGUSR1` restarts on Windows (where signaling is unreliable) and instead trigger a full process restart. It introduces a Windows-specific restart path in `src/infra/restart.ts` that spawns a detached `cmd.exe` command chain using `schtasks`/`taskkill` to stop and relaunch the gateway scheduled task. The command-session handler now selects between `SIGUSR1` scheduling vs. supervisor restart based on platform and listener presence, which keeps existing macOS/Linux behavior while making Windows use the new scheduled-task restart helper. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but the Windows restart command construction has a high-impact injection risk and should be addressed first. - Most changes are localized and align with the stated goal (avoid SIGUSR1 on Windows). However, the new `cmd.exe /C` restart chain interpolates task/profile-derived strings into a shell command, which can break in edge cases and is a security footgun if those values are attacker-influenced. There are also unused imports that may break CI depending on lint settings. - src/infra/restart.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs