fix: resolve 'Processando audio...' stuck forever on audio messages#4
Open
ti-codetec wants to merge 1 commit into
Open
fix: resolve 'Processando audio...' stuck forever on audio messages#4ti-codetec wants to merge 1 commit into
ti-codetec wants to merge 1 commit into
Conversation
The audio transcription placeholder was never replaced in several scenarios: 1. session-viewer.html had no 'transcription' WebSocket event handler at all, and the transcription was sent as role:'system' which is silently discarded. 2. When the user echo was suppressed (pendingUserEcho), the DOM <audio> element kept its local blob: URL while the transcription event arrived with the server /audio/xxx URL, causing URL matching to fail. 3. On transcription failure/abort/unavailable paths in agent.ts, no transcription event was sent, leaving the placeholder spinning forever. Changes: - Add handleTranscription() and 'transcription' case to session-viewer.html - Add sendSessionTranscription() to web.ts for session viewer broadcasts - Replace system message broadcast with proper transcription event in web.ts - Update <audio> src from blob: to server URL when echo is suppressed (all 3 viewers) - Send transcription event on error/abort/unavailable paths in agent.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the bug where "Processando áudio..." placeholder stays spinning forever when sending audio messages, requiring a page reload to clear it.
Root Causes
Three independent issues combined to cause this:
1. session-viewer.html missing transcription handler (primary cause)
The session viewer page (sub-agent sessions) had no WebSocket handler for
transcriptionevents. When audio was transcribed inweb.ts, the result was sent as arole: "system"message viabroadcastToSessionSubscribers, butappendMessage()silently discards system messages (if (role === 'system') return). The placeholder was never updated.2. DOM audio URL not updated when echo is suppressed
When the user sends audio, the
<audio>element is rendered with a localblob:URL. The server echo brings the persistent/audio/xxxURL, but the echo is suppressed bypendingUserEcho. ThesessionMessagesstore was updated but the DOM was not — so when thetranscriptionevent arrived with/audio/xxx, URL matching failed. The fallback (find last.processingelement) worked in some cases but was fragile.3. Error/abort paths didn't clear the placeholder
When audio transcription failed (Gemini unavailable, transcription error, or request aborted),
agent.tsreturned an error message but never sent atranscriptionevent, leaving the placeholder spinning forever.Changes
session-viewer.htmlhandleTranscription()function and'transcription'case in WebSocket handlerweb.tssendSessionTranscription()method; replaced system message broadcast with proper transcription event for session viewers; also send transcription on error pathmain-session-viewer.html<audio>src fromblob:to server URL when echo is suppressedweb-ui.htmlagent.tstranscriptionevent on all error/abort/unavailable paths so placeholder is always clearedTesting