fix: address review-work round 2 findings
- MCP teardown race: add shutdownGeneration counter to prevent in-flight connections from resurrecting after disconnectAll - MCP multi-key disconnect race: replace disconnectedSessions Set with generation-based Map to track per-session disconnect events - MCP clients: check shutdownGeneration in stdio/http client creators before inserting into state.clients - BackgroundManager: call clearTaskHistoryWhenParentTasksGone after timer-based task removal in scheduleTaskRemoval and notifyParentSession - BackgroundManager: clean completedTaskSummaries when parent has no remaining tasks - Plugin dispose: remove duplicate tmuxSessionManager.cleanup call since BackgroundManager.shutdown already handles it via onShutdown
This commit is contained in:
@@ -95,7 +95,7 @@ export async function disconnectSession(state: SkillMcpManagerState, sessionID:
|
||||
}
|
||||
}
|
||||
if (hasPendingForSession) {
|
||||
state.disconnectedSessions.add(sessionID)
|
||||
state.disconnectedSessions.set(sessionID, (state.disconnectedSessions.get(sessionID) ?? 0) + 1)
|
||||
}
|
||||
const keysToRemove: string[] = []
|
||||
|
||||
@@ -125,6 +125,7 @@ export async function disconnectSession(state: SkillMcpManagerState, sessionID:
|
||||
}
|
||||
|
||||
export async function disconnectAll(state: SkillMcpManagerState): Promise<void> {
|
||||
state.shutdownGeneration++
|
||||
stopCleanupTimer(state)
|
||||
unregisterProcessCleanup(state)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user