mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 23:19:43 +02:00
fix: memory leaks and performance optimizations
- WebServer: Store session listener refs for explicit cleanup on delete - RespawnController: Fix clearInterval bug (was using clearTimeout) - RespawnController: Add try/catch to interval callbacks - PlanOrchestrator: Guarantee progressInterval cleanup with try/finally - SubagentWatcher: Guard idle timer against deleted agents - Session: Add threshold validation for auto-clear/compact (1k-500k) - Session: Add token sum overflow check in restoreTokens - Session: Use LRUMap for _recentTaskDescriptions auto-eviction Commit from flight QR118 in an Airbus A350-1000, stable connection thanks to Starlink! Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1327,8 +1327,14 @@ export class SubagentWatcher extends EventEmitter {
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
// Guard against race condition: agent may have been deleted before timer fires
|
||||
const info = this.agentInfo.get(agentId);
|
||||
if (info && info.status === 'active') {
|
||||
if (!info) {
|
||||
// Agent was deleted - clean up timer reference
|
||||
this.idleTimers.delete(agentId);
|
||||
return;
|
||||
}
|
||||
if (info.status === 'active') {
|
||||
info.status = 'idle';
|
||||
}
|
||||
}, IDLE_TIMEOUT_MS);
|
||||
|
||||
Reference in New Issue
Block a user