#7128: feat: add gateway.restart RPC for graceful in-process restart
gateway
Cluster:
Gateway Hot-Reload Improvements
Fixes: operational “doubtful state” recovery.
Adds an admin-only gateway.restart RPC that schedules an in-process SIGUSR1 restart (graceful shutdown + restart) with optional restartDelayMs, reason, and note. Also writes a restart sentinel payload for post-mortem visibility.
Security: requires operator.admin scope.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a new admin-only gateway RPC method, `gateway.restart`, and wires it into the gateway request handler registry + authorization gating. The new handler optionally records a restart sentinel payload for post-mortem visibility and then schedules an in-process `SIGUSR1`-based restart via the existing `scheduleGatewaySigusr1Restart` infra helper.
Overall this fits the existing restart patterns used by `config.*` and `update.run` server methods (sentinel write + scheduled restart), but introduces a new surface area that should behave consistently with those callers and parameter shapes.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge; issues are mainly consistency/ergonomics rather than correctness.
- Changes are localized to adding a new RPC handler and routing it through existing auth + restart infra. No obvious security bypass (method is explicitly admin-gated). The main concern is parameter parsing consistency (`restartDelayMs`) and maintainability differences in how params are accessed.
- src/gateway/server-methods/gateway.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>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#13408: fix(gateway): skip SIGUSR1 restart in config.patch for noop reload ...
by rwmjhb · 2026-02-10
81.9%
#5077: fix(windows): implement reliable gateway restart via schtasks helper
by romeoscript · 2026-01-31
80.2%
#12953: fix: defer gateway restart until all replies are sent
by zoskebutler · 2026-02-10
80.0%
#9112: Fix: Prevent double SIGUSR1 restart on model switch
by vishaltandale00 · 2026-02-04
78.8%
#16170: fix: restart service manager after update.run
by Swader · 2026-02-14
78.8%
#6466: fix(gateway): add handshake timeout and connection error handling
by jarvis-raven · 2026-02-01
78.4%
#12234: gateway: incident tracking, recover command, and ciao ERR_SERVER_CL...
by levineam · 2026-02-09
78.3%
#8713: feat: gateway memory monitor, install linger, docs and failover
by quratus · 2026-02-04
77.3%
#20355: fix(gateway): enforce commands.restart guard for config.apply and c...
by Clawborn · 2026-02-18
76.7%
#13068: docs(system-prompt): warn against using exec for gateway restart
by whyuds · 2026-02-10
76.6%