Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 23, 2026

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 prevLiveSessionId so enhancement only triggers if the current tab's sessionId matches the session that was actually listening.

Key Implementation Details:

  • Added pendingCloseConfirmationTab state to the tabs lifecycle store
  • Confirmation popover in shared.tsx with keyboard support (Cmd+W to confirm)
  • handleCloseWithStop uses Zustand's subscribe to wait for listener status to change before closing the tab (replacing a setTimeout hack)
  • Removed the global registerOnClose handler from _layout.tsx that was calling stop() unconditionally

Review & Testing Checklist for Human

  • Test summary generates for correct tab: Start listening on tab A, open tab B, close tab A via confirmation. Verify summary generates for tab A's content, not tab B's. This is the most critical fix.
  • Test confirmation popover appears: Start listening on a tab, click X button or press Cmd+W. Verify the confirmation popover appears.
  • Test Cmd+W double-press: While popover is open, press Cmd+W again. Verify tab closes and summary generates.
  • Test non-listening tabs close normally: Verify tabs that aren't actively listening close immediately without popover.
  • Test no-timeout edge case: Verify that when closing an active tab, the tab actually closes (the Zustand subscribe has no timeout fallback - if backend fails to update status, tab might not close).

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:

  • The Zustand subscribe approach waits for listener status to change from "active" before closing. If the backend fails to update status, there's no timeout fallback.
  • The popover uses both local state and global state (pendingCloseConfirmationTab) - verify these stay in sync.

Link to Devin run: https://app.devin.ai/sessions/d8cb0d758c1646a1a7f09bfb04509102
Requested by: @ComputelessComputer

When closing an active listening tab, the summary was incorrectly being
generated for the next tab that became active instead of the closed tab.

This fix tracks the previous liveSessionId and only triggers enhancement
if the current tab's sessionId matches the session that was actually
listening before it stopped.

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit 7b92207
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/6973559b2bf8df00086854fe

@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 7b92207
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6973559bd714a70007cd6445

@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 7b92207
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6973559be491f20009b382a3

- Add pendingCloseConfirmationTab state to lifecycle store
- Add confirmation popover UI in shared.tsx with Cmd+W keyboard support
- Pass confirmation state through index.tsx to tab components
- Handle close with stop in sessions/index.tsx using Zustand subscribe
- Update useTabsShortcuts to show confirmation for active listening tabs
- Remove global registerOnClose handler from _layout.tsx

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration devin-ai-integration bot changed the title fix: ensure summary generation triggers for correct session on tab close fix: add confirmation popover for closing active tabs and fix summary generation Jan 23, 2026
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants