mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 16:09:43 +02:00
fix: high severity memory leaks and bugs
- Add warningTimer to AgentContext and clean it up in cleanupAgent - Clear all state in subagent-watcher stop() for clean restart - Add cleanupStaleAgents() to remove completed agents older than 24h - Delete pendingToolCalls entries after lookup to prevent memory leak - Add FSWatcher error handlers to prevent unhandled exceptions - Bump version to 0.1382 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -545,6 +545,7 @@ export class SpawnOrchestrator extends EventEmitter {
|
||||
parentSessionId: task.parentSessionId,
|
||||
depth: task.depth,
|
||||
timeoutTimer: null,
|
||||
warningTimer: null,
|
||||
progressTimer: null,
|
||||
status: 'initializing',
|
||||
startedAt: null,
|
||||
@@ -688,9 +689,9 @@ export class SpawnOrchestrator extends EventEmitter {
|
||||
private setupTimeout(agent: AgentContext): void {
|
||||
const timeoutMs = agent.task.spec.timeoutMinutes * 60 * 1000;
|
||||
|
||||
// Warning at 90%
|
||||
// Warning at 90% - store timer for cleanup
|
||||
const warningMs = timeoutMs * 0.9;
|
||||
setTimeout(() => {
|
||||
agent.warningTimer = setTimeout(() => {
|
||||
if (agent.status === 'running' && this._sessionCreator && agent.sessionId) {
|
||||
this._sessionCreator.writeToSession(
|
||||
agent.sessionId,
|
||||
@@ -818,6 +819,10 @@ export class SpawnOrchestrator extends EventEmitter {
|
||||
clearTimeout(agent.timeoutTimer);
|
||||
agent.timeoutTimer = null;
|
||||
}
|
||||
if (agent.warningTimer) {
|
||||
clearTimeout(agent.warningTimer);
|
||||
agent.warningTimer = null;
|
||||
}
|
||||
if (agent.progressTimer) {
|
||||
clearInterval(agent.progressTimer);
|
||||
agent.progressTimer = null;
|
||||
|
||||
Reference in New Issue
Block a user