Repository navigation
Keep closed tab agents from reappearing - #6095
Conversation
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 3511c31 on Jun 22, 2026 6:52pm UTC. |
📝 WalkthroughWalkthroughThis PR implements end-to-end tab-prefix eviction for agent status caches. A new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Closing a terminal tab now clears the agent-status cache for that tab in both renderer and main process, then suppresses late hook/status replays for that closed tab id during the app session. This prevents completed agent rows from returning after their terminal tab is gone.
This is a separate root-cause fix from #5914's selector-level guard.
Design Approach
dropAgentStatusByTabPrefix(tabId)still removes local rows, and now also records the tab as closed and sendsagentStatus.dropByTabPrefix(tabId)through preload/IPC.agentStatus:setevents for explicitly closed tab ids.Scratch design doc:
.tmp/agent-status-cache-tab-close.md(not committed).Pipeline Evidence
Design review: completed clean earlier in the Brennan YOLO Lite run.
Implementation: completed in the separate worktree
fix-closed-tab-agent-status-cache-cleanup.Deviation from design: manual validation proved a 15-second suppression window was too short, so the implementation uses an app-session closed-tab marker instead. Tab ids are generated per tab, so this is the safer root-cause behavior.
Completeness verification: completed clean after expanded coverage.
Code review:
pushTargetclearing.origin/main, and Round 2 returned clean from both reviewers.brennan-test-changes: verdict wasshould land.Manual validation:
UserPromptSubmit, thenStop, and confirmed main + renderer had the row.validation-screenshots/closed-tab-agent-status-cleanup-after-late-hook-clean.png(not committed).Accepted gaps:
origin/main.Validation
pnpm vitest run --config config/vitest.config.ts src/main/agent-hooks/migration-unsupported-pty-state.test.ts src/main/agent-hooks/server.test.ts src/main/ipc/agent-hooks.test.ts src/renderer/src/hooks/useIpcEvents.test.ts src/renderer/src/store/slices/agent-status-ack-cleanup.test.ts src/renderer/src/store/slices/agent-status-drop-ipc.test.ts src/renderer/src/web/web-preload-api.test.tspnpm typecheckpnpm lintgit diff --check origin/main...HEAD && git diff --checkPost-PR Stabilization
Completed after the required 8-minute wait.
verifypassed,track-community-prpassed.