fix: prevent stale subagent data from showing in windows

- Reduce getRecentSubagents window from 60 to 15 minutes
- Skip old/completed agents when restoring window states (10 min cutoff)
- Clear old activity data when new agent with same ID is discovered
- Force close existing window for agentId before opening fresh one

Fixes issue where old prompts/input from previous Ralph Loop runs
were displayed when clicking on subagent windows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-29 12:04:14 +01:00
co-authored by Claude Opus 4.5
parent 5c2d985dce
commit a73f7c3a4f
4 changed files with 22 additions and 7 deletions
+2 -2
View File
@@ -4600,7 +4600,7 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
scheduledRuns: Array.from(this.scheduledRuns.values()),
respawnStatus,
globalStats: this.store.getAggregateStats(activeSessionTokens),
subagents: subagentWatcher.getRecentSubagents(60), // Last hour of subagent activity
subagents: subagentWatcher.getRecentSubagents(15), // Last 15 min - filter out stale agents from previous runs
timestamp: Date.now(),
};
}
@@ -4630,7 +4630,7 @@ NOW: Generate the implementation plan for the task above. Think step by step.`;
scheduledRuns: Array.from(this.scheduledRuns.values()),
respawnStatus,
globalStats: this.store.getAggregateStats(activeSessionTokens),
subagents: subagentWatcher.getRecentSubagents(60),
subagents: subagentWatcher.getRecentSubagents(15), // 15 min to avoid stale agents
timestamp: Date.now(),
};
}