fix: add confirmation popover for closing active tabs and fix summary generation #3318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements two related fixes for closing active listening tabs:
1. Confirmation Popover UI
When attempting to close an active listening tab (via X button or Cmd+W), a confirmation popover now appears asking the user to confirm. The user can confirm by clicking "Close" or pressing Cmd+W again.
2. Summary Generation for Correct Session
Fixes the bug where closing an active listening tab would generate a summary for the wrong tab (the next tab that becomes active) instead of the closed tab. The fix tracks
prevLiveSessionIdso enhancement only triggers if the current tab'ssessionIdmatches the session that was actually listening.Key Implementation Details:
pendingCloseConfirmationTabstate to the tabs lifecycle storeshared.tsxwith keyboard support (Cmd+W to confirm)handleCloseWithStopuses Zustand'ssubscribeto wait for listener status to change before closing the tab (replacing a setTimeout hack)registerOnClosehandler from_layout.tsxthat was calling stop() unconditionallyReview & Testing Checklist for Human
Notes
This combines the confirmation modal UI from PR #3289 with a fix for the summary generation targeting the wrong session.
Potential concerns worth verifying:
pendingCloseConfirmationTab) - verify these stay in sync.Link to Devin run: https://app.devin.ai/sessions/d8cb0d758c1646a1a7f09bfb04509102
Requested by: @ComputelessComputer