fix(web): relay Codex responses to voice sessions#640
Open
PeterDraex wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Findings
- [Major] Historical ready messages can trigger fresh voice-ready prompts —
newMessageshere means “not in this component ref yet,” not “arrived live.” Initial message hydration, refetches, or loading older history can add oldready/task_completemessages toprops.messages; the new scan then callsreportVoiceReady()and sends a stale ready prompt to an active voice session. Evidence:web/src/components/SessionChat.tsx:244
Suggested fix:// Move ready detection to the live SSE message path instead of scanning the // whole visible message window in SessionChat. if (event.type === 'message-received') { ingestIncomingMessages(event.sessionId, [event.message]) if ( event.sessionId === getCurrentRealtimeSessionId() && isVoiceReadyMessage(event.message) ) { voiceHooks.onReady(event.sessionId) } }
Summary
- Review mode: initial
- One issue found: the new ready-message trigger can replay historical completion events as current voice-ready notifications.
Testing
- Not run (automation)
HAPI Bot
|
|
||
| if (newMessages.length > 0) { | ||
| voiceHooks.onMessages(props.session.id, newMessages) | ||
| if (newMessages.some(isVoiceReadyMessage)) { |
There was a problem hiding this comment.
[Major] Historical ready messages can trigger fresh voice-ready prompts
newMessages is only “not present in prevMessagesRef,” so it also includes messages introduced by initial hydration/refetch and older-history loads. With this new branch, any historical ready / task_complete in those batches calls reportVoiceReady() and can send a stale ready prompt to an active voice session.
Suggested fix:
// Move ready detection to the live SSE message path instead of scanning the
// whole visible message window in SessionChat.
if (event.type === 'message-received') {
ingestIncomingMessages(event.sessionId, [event.message])
if (
event.sessionId === getCurrentRealtimeSessionId()
&& isVoiceReadyMessage(event.message)
) {
voiceHooks.onReady(event.sessionId)
}
}
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
messagepayloads for realtime voice context so completed Codex responses reach ElevenLabs sessionssession.thinkingtransitionsTesting