← Back to PRs

#4108: gateway: hot-reload heartbeat when agents.list changes

by jifanchn open 2026-01-29 17:55 View on GitHub →
docs gateway
## 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