MAESTRO: fix(hooks): add session-complete handler to enable orphan reaper cleanup

Cherry-picked from PR #844 by @thusdigital. Sessions stayed in active
sessions map forever after summarize, causing the orphan reaper to think
all processes were still active. Adds session-complete as Stop phase 2
hook that calls POST /api/sessions/complete to remove sessions from the
active map, allowing the reaper to correctly identify and clean up
orphaned worker processes. Fixes #842.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-06 03:23:13 -05:00
parent 56df2c45e5
commit 5dffb1ebb0
5 changed files with 127 additions and 7 deletions
+1 -1
View File
@@ -908,7 +908,7 @@ async function main() {
if (!platform || !event) {
console.error('Usage: claude-mem hook <platform> <event>');
console.error('Platforms: claude-code, cursor, raw');
console.error('Events: context, session-init, observation, summarize');
console.error('Events: context, session-init, observation, summarize, session-complete');
process.exit(1);
}