fix: enhance gateway logging for Windows dev restart debugging (#665)

Add comprehensive debug logging throughout the gateway lifecycle to
help troubleshoot nodemon restart issues on Windows, where SIGTERM
is used instead of SIGUSR2.

Changes:
- Enhanced shutdown handler to log all signals and env var states
- Gateway manager now logs process detachment mode explicitly
- Added environment variable confirmation on bootstrap
- Updated gateway-development.md with new debug logs and troubleshooting steps

Benefits:
- Easier troubleshooting of gateway lifecycle issues
- Clear visibility into signal handling during nodemon restarts
- Better cross-platform development experience
- Production behavior remains unchanged

Testing:
-  Windows: Gateways persist across nodemon restarts
-  macOS/Linux: Existing SIGUSR2 behavior preserved
-  Production: Default shutdown cleanup unchanged
-  Backward compatibility: No breaking changes

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-12 22:03:28 +08:00
committed by GitHub
parent 5bd1475a83
commit 44d1b13741
4 changed files with 161 additions and 10 deletions
+4
View File
@@ -85,6 +85,10 @@ export async function bootstrap() {
const authToken = await getToken()
await initLoginLimiter()
// Debug: log environment variable
console.log('[bootstrap] HERMES_WEB_UI_STOP_GATEWAYS_ON_SHUTDOWN =', process.env.HERMES_WEB_UI_STOP_GATEWAYS_ON_SHUTDOWN)
const app = new Koa()
await initGatewayManager()