Skip to content

fix: fire afterListeningStopped hook on auto-stop#4448

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1772861756-fire-hook-on-auto-stop
Open

fix: fire afterListeningStopped hook on auto-stop#4448
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1772861756-fire-hook-on-auto-stop

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

Moves the afterListeningStopped hook dispatch from the manual stop() action into the handleLifecycleEvent handler for "inactive" transitions. This ensures the hook fires for both manual stops and auto-stops (e.g., meeting app closes, audio device disconnects).

Previously, the hook was only called inside stop()'s onSuccess handler, meaning auto-stop paths that go directly through the lifecycle event system never triggered it. By consolidating to a single dispatch site in the "inactive" handler, double-firing is eliminated by design.

What changed:

  • handleLifecycleEvent("inactive"): Captures sessionId and status before state is cleared, then dispatches afterListeningStopped if transitioning from "active" or "finalizing" with a valid session.
  • stop(): Stripped of hook dispatch logic — now only calls stopSessionEffect() and handles failure. The lifecycle event handler takes care of the hook.

Review & Testing Checklist for Human

  • Verify that manual stop() always produces an "inactive" lifecycle event. This is the critical assumption: since the hook was moved out of stop()'s success handler and into the lifecycle handler, if stopSessionEffect() succeeds without emitting an "inactive" event, the hook would silently not fire for manual stops. Trace through the Rust backend (tauri-plugin-listener) to confirm.
  • Test manual stop: Click stop during a live session → confirm afterListeningStopped fires with correct sessionId / resource_dir.
  • Test auto-stop: Disconnect audio device or close a meeting app mid-session → confirm afterListeningStopped fires.
  • Test double-fire: Manual stop that also triggers an inactive lifecycle event → confirm the hook fires exactly once.

Notes

  • The pre-existing typecheck failure in packages/tiptap/src/prompt/jinja.ts (codemirror version mismatch) is unrelated to this change.
  • app_meeting is passed as null in the hook args, consistent with the original stop() behavior.

Link to Devin session: https://app.devin.ai/sessions/d7e04927d2ae4639a200a9431e50da35
Requested by: @ComputelessComputer

… event)

Move the afterListeningStopped hook dispatch from the manual stop() action
into the handleLifecycleEvent 'inactive' handler. This ensures the hook
fires regardless of whether the session ended via manual stop or auto-stop
(e.g. meeting app closes, audio device disconnects).

By consolidating the hook dispatch to a single location, double-firing is
eliminated by design — the hook always fires exactly once when the session
transitions to inactive from an active or finalizing state.

Co-Authored-By: John <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 Mar 7, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 7de1cb9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69abb9ca520ec10008bc379f

@netlify
Copy link

netlify bot commented Mar 7, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 7de1cb9
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69abb9ca5fd6ab000873dce3

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.

1 participant