fix: clean up Roundtable UI state after QA/Discussion request failure#128
Merged
wyuc merged 3 commits intoTHU-MAIC:mainfrom Mar 24, 2026
Merged
fix: clean up Roundtable UI state after QA/Discussion request failure#128wyuc merged 3 commits intoTHU-MAIC:mainfrom
wyuc merged 3 commits intoTHU-MAIC:mainfrom
Conversation
wyuc
previously approved these changes
Mar 22, 2026
Contributor
wyuc
left a comment
There was a problem hiding this comment.
Clean refactor. Consolidates the duplicated error handling into clearLiveSessionAfterError and adds the missing Stage/Engine notification. restoreSavedLectureState extraction is a nice cleanup too. LGTM.
Contributor
|
Approved. There are merge conflicts with main — could you rebase when you get a chance? |
…THU-MAIC#127) When /api/chat fails mid-stream during QA or Discussion, the catch blocks only appended an error message to the chat panel. The Roundtable live UI (bubble, thinking animation, engine mode) was never cleaned up, leaving the interface stuck until page refresh. Changes: - Add clearLiveSessionAfterError() in use-chat-sessions.ts that notifies Stage via onLiveSessionError callback on request failure - Add handleLiveSessionError() in stage.tsx to reset all live UI state and transition PlaybackEngine back to idle - Add handleDiscussionError() in engine.ts to exit live mode without triggering the normal discussion-end sequence - Add engine.resume() in doResumeTopic() to sync engine mode after soft-pause resume Closes THU-MAIC#127
de7542d to
c70d966
Compare
Contributor
Author
Rebased onto latest main — resolved the conflict with #129's livePausedRef (both additions kept, no logical overlap). |
wyuc
approved these changes
Mar 24, 2026
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 #127 — When
/api/chatfails mid-stream during a QA or Discussion session, the Roundtable live UI (bubble, thinking animation, engine mode) is never cleaned up, leaving the interface stuck until page refresh.Problem
The
catchblocks inresumeSession(),sendMessage(), andstartDiscussion()only append an error message to the chat panel. They don't notifyStageto clean up live UI state, nor do they transition thePlaybackEngineout oflivemode.This affects users with unstable networks or when the LLM provider returns server errors mid-stream.
Changes
use-chat-sessions.tsclearLiveSessionAfterError()helper that cleans current buffer, appends error message, and notifies Stage viaonLiveSessionErrorcallbackchat-area.tsxonLiveSessionErrorcallbackstage.tsxhandleLiveSessionError()to reset all live UI state + callengine.handleDiscussionError(). Also addengine.resume()indoResumeTopic()to sync engine mode after soft-pauseengine.tshandleDiscussionError()to exit live mode gracefully without triggering the normal discussion-end flash sequenceHow it works
The session is not hard-closed — it remains retryable.
Verification
latex-to-omml.tserror (unrelated)