fix(wiki-compose): stop auto-start effect from aborting SSE mid-run#993
Draft
cursor[bot] wants to merge 2 commits into
Draft
fix(wiki-compose): stop auto-start effect from aborting SSE mid-run#993cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
- Align frontend backend resolution with Google-fixed Wiki Compose model - Extract session reducer module; slim useWikiComposeSession hook - Consolidate auto-start via startPolicy and canRetryStart - Deduplicate compose session locale prep on API routes - Remove duplicate props and dead outline preview ternary Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>
When createSession commits, awaitingFreshStart flips and the auto-start useEffect cleanup called abort() on the in-flight POST /run stream. Fresh compose sessions could stall at pending with no SSE progress.
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.
Bug and impact
Fresh Wiki Compose sessions (
startPolicy: when-backend-ready, nosessionIdin the URL) could stall immediately after session creation: the row reachedpendingbutPOST /runSSE was aborted before events arrived, so Brief/research/draft UI never progressed.Root cause
PR #992 refactored auto-start into a
useEffectthat listedawaitingFreshStartin its dependency array and calledabortRef.current?.abort()in the effect cleanup. WhencreateSessioncommitted,awaitingFreshStartflipped tofalse, React re-ran the effect, cleanup aborted the in-flight stream, andstreamRunexited without updating status beyondpending.The pre-refactor hook used
[]deps and only aborted on unmount.Fix
start()error reporting).createSessionand delayedrunSession.Validation
bunx vitest run src/hooks/useWikiComposeSession.test.ts(10/10 pass)