Skip to content

Auto-enhance fails when session tab is not in view #3623

@devin-ai-integration

Description

@devin-ai-integration

Problem

When a summary is being generated but the session tab is not in view (user switched to another tab), the summary may fail to save properly.

Root Cause Analysis

The useAutoEnhance hook (and its sub-hooks useListenerStopTrigger and useAutoEnhanceRunner) only run when the session tab component is rendered. Since only the active tab's content is rendered, switching tabs unmounts these hooks.

Scenario:

  1. User starts recording on Session A
  2. User switches to Session B tab (Session A's useAutoEnhance is now unmounted)
  3. Recording stops
  4. useListenerStopTrigger in Session A is not running, so it never detects the stop
  5. Auto-enhancement never triggers for Session A

Related Work

PR #3581 fixed two different bugs in the auto-enhance logic:

  1. Task never starting: The enhanceTaskId was computed at render time from a null ref
  2. Infinite loop: The usePrevious hook caused timing issues triggering enhancement repeatedly

These fixes addressed issues when the tab IS in view. The "not in view" scenario is a separate issue.

Potential Solutions

  1. Global listener approach: Move the auto-enhance trigger logic to a global hook that runs at the app layout level, independent of which tab is active. This ensures enhancement is triggered based on session lifecycle rather than component lifecycle.

  2. Background task queue: When recording stops, queue the enhancement task in a global store that persists regardless of tab state.

  3. Persist trigger state: Store the "needs enhancement" flag in the session data itself, and check for pending enhancements when a tab becomes active.

Notes

  • The current modular structure from PR Fix and refactor auto-enhance logic #3581 (eligibility.ts, runner.ts, trigger.ts) provides a good foundation for implementing a fix
  • Any solution should avoid duplicate enhancement triggers
  • The fix should work for multiple concurrent sessions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions