mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-03 09:09:33 +01: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:
1 parent
cd4905287e
commit
eb7c005363
5 files changed
+360
-225
No files matched your search
@@ -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