Skip to content

Comments

feat(listener): add loading state events for better UI feedback#2517

Closed
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1766545777-listener-loading-states
Closed

feat(listener): add loading state events for better UI feedback#2517
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1766545777-listener-loading-states

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 24, 2025

feat(listener): add loading state events for better UI feedback

Summary

Adds new SessionEvent variants to provide UI visibility into the connection and initialization phases between "start listening" and "got first transcript". Previously, there was a 1-8 second blind spot where the UI had no insight into what was happening.

New events:

  • InitializingAudio - emitted when SourceActor begins audio initialization
  • AudioReady { mode, device } - emitted after audio streams are successfully set up (includes audio mode and device name)
  • AudioError { error, device } - emitted on mic/device failures
  • Connecting - emitted when ListenerActor starts WebSocket connection to STT service
  • Connected { adapter } - emitted after successful WebSocket connection (includes adapter name like "Deepgram", "OpenAI", etc.)
  • ConnectionError { error, is_retryable } - emitted on connection failure

Event flow:

start_session() → InitializingAudio → AudioReady → Connecting → Connected → (existing events)
                                    ↘ AudioError              ↘ ConnectionError (on failure)

Frontend state changes:

  • Added LoadingPhase type: "idle" | "initializing_audio" | "audio_ready" | "connecting" | "connected"
  • Added loadingPhase and lastError fields to GeneralState.live
  • Wired up handlers for all new events in general.ts

Updates since last revision

  • Added AudioMode enum for serializing ChannelMode to frontend
  • Enhanced events with context data (mode, device, adapter)
  • Added AudioError event for mic/device failures
  • Replaced retry_count with is_retryable boolean in ConnectionError
  • Added frontend wiring - all new events are now handled in the Zustand store

Review & Testing Checklist for Human

  • Verify TypeScript bindings regeneration: Local regeneration failed due to workspace issue (plugins/db missing Cargo.toml). Verify CI regenerates bindings correctly and types match.
  • Test event ordering: Confirm events fire in expected sequence during normal startup and error scenarios.
  • Test error scenarios: Disconnect network before starting session to verify ConnectionError fires; deny mic permission to verify AudioError fires.
  • Verify is_retryable logic: Currently hardcoded to true for all connection errors - may need refinement for non-retryable errors (e.g., auth failures).
  • UI integration: The loadingPhase and lastError state fields are populated but UI components don't consume them yet - this PR only adds the state management layer.

Recommended test plan:

  1. Start a listening session and observe events in dev tools (check loadingPhase transitions)
  2. Test with network disconnected to verify ConnectionError fires and lastError is set
  3. Test with mic unavailable/denied to verify AudioError fires
  4. Verify existing functionality (transcription) still works
  5. Check that state resets properly when session becomes inactive

Notes

  • UI components to display loading phases are not included - this PR adds the event infrastructure and state management
  • The AudioError is emitted when StreamFailed message is received in SourceActor

Link to Devin run: https://app.devin.ai/sessions/d08f3c9e84644c12bc2c884f7951c29d
Requested by: yujonglee (@yujonglee)

Add new SessionEvent variants to provide visibility into the connection
and initialization phases between 'start listening' and 'got first transcript':

- InitializingAudio: emitted when SourceActor starts audio initialization
- AudioReady: emitted after audio streams are successfully set up
- Connecting: emitted when ListenerActor starts WebSocket connection
- Connected: emitted after successful WebSocket connection
- ConnectionError: emitted when connection fails (with error details)

These events allow the UI to show appropriate loading states during the
1-8 second window that was previously a blind spot.

Co-Authored-By: yujonglee <yujonglee.dev@gmail.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 Dec 24, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit f60f926
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/694b63491cabbb0008ca9bd8
😎 Deploy Preview https://deploy-preview-2517--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit f60f926
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/694b634931c1bf00081d13fb
😎 Deploy Preview https://deploy-preview-2517--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…ontend wiring

- Add AudioMode enum for serializing ChannelMode
- Enhance AudioReady event with mode and device fields
- Add AudioError event for mic/device failures
- Enhance Connected event with adapter field
- Replace retry_count with is_retryable in ConnectionError
- Wire up all new events in frontend general.ts
- Add loadingPhase and lastError fields to live state

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@yujonglee yujonglee closed this Dec 29, 2025
@yujonglee yujonglee deleted the devin/1766545777-listener-loading-states branch December 29, 2025 00:33
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