fix: shutdown ACP backend on session kill to reap CC child processes (#3184)#3191
Merged
aegis-gh-agent[bot] merged 1 commit intoMay 11, 2026
Merged
Conversation
…3184) Root cause: killSession() in session.ts only marks the session as 'killed' in state — it never calls acpBackend.shutdownSession() to terminate the actual Claude Code child process. Each orphaned CC process consumes ~250MB RSS, eventually causing OOM kills that block all development. Fix: In the DELETE /v1/sessions/:id handler, call acpBackend.shutdownSession() before sessions.killSession(). The shutdown follows the existing SIGTERM → wait → SIGKILL escalation in AcpChildProcess. Best-effort with .catch(() => {}) — session may not have an ACP runtime (e.g., non-ACP mode or already crashed process). Refs: #3184
Contributor
There was a problem hiding this comment.
✅ Approved. 9-line surgical fix for #3184.\n\nRoot cause: DELETE /v1/sessions/:id never called acpBackend.shutdownSession() — CC child process left as orphan (~250MB RSS each).\n\nFix: Calls shutdown (SIGTERM → wait → SIGKILL via shutdownRuntime) before marking killed. Best-effort .catch(() => {}) for sessions without ACP runtime. Guards on acpBackend && ctx.config.acpEnabled.\n\nshutdownSession signature verified — sessionId, tenantId, ownerKeyId match AcpBackendShutdownSessionInput. No new dependencies. CI running.
2 tasks
aegis-gh-agent Bot
pushed a commit
that referenced
this pull request
May 11, 2026
Covers PRs #3176-#3197 merged after the initial CHANGELOG update (#3175): - Added: budget progress bars (#3183), Telegram verbose mode (#3196), dashboard i18n (#3192) - Fixed: RBAC guards (#3187), process reap (#3191), i18n aria-labels (#3195), security helpers (#3177) - Docs: threat matrix (#3176), blog (#3179), RBAC docs (#3188, #3193), tg-verbose docs (#3197)
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause:
killSession()insession.tsonly marks the session askilledin state — it never callsacpBackend.shutdownSession()to terminate the actual Claude Code child process. Each orphaned CC process consumes ~250MB RSS, eventually causing OOM kills that block all development.Fix
In the
DELETE /v1/sessions/:idhandler (src/routes/sessions.ts), callacpBackend.shutdownSession()beforesessions.killSession().The
shutdownSessioncall:client.shutdown()which does: close stdin → wait for graceful exit → SIGTERM → wait → SIGKILLBest-effort with
.catch(() => {})— session may not have an ACP runtime (non-ACP mode, already crashed process).Evidence
Verification
Files changed
src/routes/sessions.ts— addacpBackend.shutdownSession()call beforesessions.killSession()Fixes #3184.