-
Notifications
You must be signed in to change notification settings - Fork 545
Description
Problem
When a summary is being generated and the user switches away from the session tab, the generated summary is not saved/preserved. The summary generation continues in the background (via Zustand), but the React-based handleEnhanceSuccess callback in useAutoEnhanceRunner doesn't fire because the component unmounts when the tab loses focus.
Root Cause
PR #3881 (5dae51ff4) fixed this by adding an onComplete callback to the generate() call in runner.ts. This callback runs in Zustand's async context (not React lifecycle), so it persists even when the tab component unmounts.
However, this fix was accidentally removed in commit 789c8643c (PR #3942 - "Chat various improvements"), causing the bug to regress.
Current State
runner.ts: Thegenerate()call at line ~187 has noonCompletecallback. It relies on a ReactuseEffect(line ~114) watching task state transitions, which only works while the component is mounted.options-menu.tsx: The manual "enhance" trigger (triggerEnhance) at line ~103 still has theonCompletecallback — so manual enhancement survives tab switches, but auto-enhancement does not.
How to Reproduce
- Start a recording session
- Stop recording (auto-enhance triggers)
- Switch to a different tab while the summary is generating
- Switch back — the summary content is lost
Previous Fix Attempts
- PR fix: save summary when session tab is not in view #3579 (branch
devin/1770079007-fix-summary-save-not-in-view, closed) — attempted auseGlobalAutoEnhancehook at app layout level; superseded by fix: persist summary when tab is not active during generation #3881 - PR fix: persist summary when tab is not active during generation #3881 (merged) — added
onCompletecallbacks; fix was later removed in Chat various improvements #3942 - Related closed issues: Auto-enhance fails when session tab is not in view #3623, Title and summary generation sometimes not triggered after recording stops #3535
Suggested Fix
Re-add the onComplete callback to the generate() call in apps/desktop/src/hooks/autoEnhance/runner.ts, similar to how options-menu.tsx does it. This ensures the summary is persisted via TinyBase even when the React component unmounts.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status