fix: memory leaks and error handling improvements

- execution-bridge: track and cleanup retry timers to prevent memory leaks
- model-selector: add exhaustive type check for ModelTier
- ralph-tracker: fix division by zero when summary.total is 0
- respawn-controller: remove event listeners on stop to prevent memory leaks
- screen-manager: use Promise.allSettled for better error handling in stats
- session-manager: use Promise.allSettled for stopAllSessions resilience

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-28 20:19:14 +01:00
co-authored by Claude Opus 4.5
parent e0a695fed7
commit 8fb8e6fa83
6 changed files with 55 additions and 10 deletions
+8 -1
View File
@@ -191,12 +191,19 @@ export class SessionManager extends EventEmitter {
/**
* Stops all active sessions.
* Uses Promise.allSettled to ensure all sessions are stopped even if some fail.
*/
async stopAllSessions(): Promise<void> {
const stopPromises = Array.from(this.sessions.keys()).map((id) =>
this.stopSession(id)
);
await Promise.all(stopPromises);
const results = await Promise.allSettled(stopPromises);
// Log any failures but don't throw - best effort cleanup
for (const result of results) {
if (result.status === 'rejected') {
console.error('[SessionManager] Failed to stop session:', result.reason);
}
}
}
/**