fix(book): stream long-running operations over WebSocket#658
Conversation
|
Human browser smoke test passed on the isolated v1.5.2 test instance. The UI showed no error, streamed visible progress updates, automatically advanced to Confirm Spine, started compilation after confirmation, and the generated chapter opened successfully. This complements the automated Next.js WebSocket acceptance: confirm_proposal completed in 41.5s and compile_page completed in 691.2s with zero socket hang ups or ECONNRESET. |
|
Additional multi-user verification passed after the browser smoke test. Using an enabled non-admin user in the isolated data copy, confirm_proposal completed through the Next.js WebSocket in 43.0s with 10 events, and compile_page completed in 789.0s with 22 events (21 progress events). Both operations exceeded the old HTTP proxy failure window and received their final result frames. The isolated container/data copy was then removed; production remained healthy and unchanged. |
|
Thanks for your contribution! |
The persistent-listener useEffect that used openBookSocket was removed in #658 when confirm-proposal/compile-page moved onto per-operation sockets via runBookSocketOperation. The exported helper had no remaining callers; remove it and keep only the BookWsEvent re-export. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rations-dev fix(book): stream long-running operations over WebSocket
The persistent-listener useEffect that used openBookSocket was removed in HKUDS#658 when confirm-proposal/compile-page moved onto per-operation sockets via runBookSocketOperation. The exported helper had no remaining callers; remove it and keep only the BookWsEvent re-export. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Problem
The current Web UI waits on long-running REST requests. Next.js resets those connections after roughly 35-47 seconds while the FastAPI backend continues generating, so the UI reports a false failure and users may retry the same Book operation.
The same failure mode also affects compile-page during slow providers and fallback chains.
Fix
The frontend now opens a short-lived Book WebSocket for each long operation, sends the existing confirm_proposal or compile_page message, streams progress events, and resolves only after the matching result event. Each page compilation gets its own socket, so parallel page generation remains parallel.
Browser authentication continues to use the existing dt_token cookie; credentials are not added to the WebSocket URL.
Verification
Fixes #607