← Back to PRs

#7128: feat: add gateway.restart RPC for graceful in-process restart

by AkashaBot open 2026-02-02 12:31 View on GitHub →
gateway
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