Refactor api-proxy SIGTERM/SIGINT shutdown flow into a shared handler#3209
Conversation
There was a problem hiding this comment.
Pull request overview
This PR centralizes the API proxy’s signal shutdown behavior so SIGTERM and SIGINT share the same graceful shutdown path.
Changes:
- Extracts duplicated shutdown logic into
shutdownGracefully(signal). - Updates SIGTERM and SIGINT handlers to delegate to the shared helper while preserving signal-specific logging.
Show a summary per file
| File | Description |
|---|---|
containers/api-proxy/server.js |
Refactors duplicated signal shutdown handlers into a shared helper for OIDC provider shutdown, log stream closing, and process exit. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
Smoke Test: Copilot BYOK (Offline) Mode
Note: Running in BYOK offline mode ( Overall: FAIL — Pre-step smoke data was not injected (template variables
|
Smoke Test Results
Result: 2/3 PASS (1 environment limitation, 2 core functions working)
|
🤖 Smoke Test Results
Overall: FAIL — GitHub MCP returned 401 credentials error; workflow template variables were not expanded for HTTP/PR data tests.
|
|
PR titles: unavailable (safeinputs-gh missing; gh returned 401) Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison Results
Overall: ❌ Not all versions match — Python and Node.js differ between host and chroot environments.
|
|
Smoke test results: FAIL (GitHub MCP and Connectivity issues) Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results
Overall: FAIL —
|
|
@copilot address review feedback |
Addressed in commit |
Bug Fix
What was the bug?
containers/api-proxy/server.jshad duplicated graceful-shutdown logic in bothSIGTERMandSIGINThandlers (same OIDC shutdown + log stream close + exit path). This created avoidable maintenance risk in a security-critical proxy because future shutdown changes had to be kept in sync manually.How did you fix it?
shutdownGracefully(signal), including provider shutdown,closeLogStream(), andprocess.exit(0).SIGTERMandSIGINThandlers to delegate to the shared function, preserving signal-specific log messages via thesignalparameter.Testing
Behavior is unchanged by design; this change centralizes existing shutdown steps into a single implementation to prevent divergence.