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:
YeonGyu-Kim
2026-03-11 21:16:37 +09:00
parent 03eaa429ce
commit ff536e992a
23 changed files with 253 additions and 143 deletions
-4
View File
@@ -16,7 +16,6 @@ describe("createPluginDispose", () => {
const dispose = createPluginDispose({
backgroundManager,
skillMcpManager,
tmuxSessionManager: { cleanup: async (): Promise<void> => {} },
disposeHooks: (): void => {},
})
@@ -39,7 +38,6 @@ describe("createPluginDispose", () => {
const dispose = createPluginDispose({
backgroundManager,
skillMcpManager,
tmuxSessionManager: { cleanup: async (): Promise<void> => {} },
disposeHooks: (): void => {},
})
@@ -71,7 +69,6 @@ describe("createPluginDispose", () => {
skillMcpManager: {
disconnectAll: async (): Promise<void> => {},
},
tmuxSessionManager: { cleanup: async (): Promise<void> => {} },
disposeHooks: (): void => {
disposeCreatedHooks({
runtimeFallback,
@@ -107,7 +104,6 @@ describe("createPluginDispose", () => {
const dispose = createPluginDispose({
backgroundManager,
skillMcpManager,
tmuxSessionManager: { cleanup: async (): Promise<void> => {} },
disposeHooks: disposeHooks.run,
})