#4108: gateway: hot-reload heartbeat when agents.list changes
docs
gateway
Cluster:
Gateway Hot-Reload Improvements
## Summary
When agents are added or removed via config changes, the heartbeat scheduler now restarts automatically. This ensures newly added agents get their heartbeat tasks scheduled without requiring a full gateway restart.
**Use case**: In multi-tenant deployments where agents are dynamically registered (e.g., via extension plugins), new agents need their heartbeat tasks to start without restarting the entire gateway.
## Changes
- Added `agents.list` to `BASE_RELOAD_RULES` with `restart-heartbeat` action
- Added test case to verify the behavior
## Test plan
- [x] `pnpm exec vitest run src/gateway/config-reload.test.ts` passes (9 tests)
- [ ] CI passes
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR extends the gateway config hot-reload rules so that changes under `agents.list` trigger a heartbeat scheduler restart, ensuring newly added/removed agents get their heartbeat tasks (re)scheduled without a full gateway restart. It also adds a unit test asserting that a change to `agents.list` sets `restartHeartbeat` in the reload plan.
The change fits into the existing `buildGatewayReloadPlan` mechanism in `src/gateway/config-reload.ts`, where config path prefixes map to either no-op, hot actions (like restarting cron/heartbeat), or full gateway restart.
<h3>Confidence Score: 4/5</h3>
- This PR is low-risk and likely safe to merge; the behavior change is localized to config reload planning.
- Changes are limited to adding a new reload prefix and a simple unit test; no runtime control flow changes outside the existing reload-plan mapping. Main risk is the test not fully reflecting real-world `diffConfigPaths` output for `agents.list` shape changes.
- src/gateway/config-reload.ts, src/gateway/config-reload.test.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7747: Gateway: add zero-latency hot-reload for agent bindings
by NikolasP98 · 2026-02-03
84.7%
#13408: fix(gateway): skip SIGUSR1 restart in config.patch for noop reload ...
by rwmjhb · 2026-02-10
83.8%
#22720: fix: notify sessions on invalid config during hot-reload
by jayleekr · 2026-02-21
77.9%
#11280: fix(gateway): add meta prefix to reload rules to prevent double SIG...
by cheenu1092-oss · 2026-02-07
77.8%
#8473: fix(gateway): prevent spurious restarts on meta.lastTouchedAt changes
by adam-smeth · 2026-02-04
76.2%
#20355: fix(gateway): enforce commands.restart guard for config.apply and c...
by Clawborn · 2026-02-18
75.6%
#11746: fix: treat meta config paths as no-op to prevent unnecessary gatewa...
by QDenka · 2026-02-08
75.1%
#7128: feat: add gateway.restart RPC for graceful in-process restart
by AkashaBot · 2026-02-02
75.1%
#12234: gateway: incident tracking, recover command, and ciao ERR_SERVER_CL...
by levineam · 2026-02-09
73.3%
#12953: fix: defer gateway restart until all replies are sent
by zoskebutler · 2026-02-10
73.3%