Repository navigation
fix(web): seed new conversation from server prologue before appending question - #18206
Conversation
… question A freshly created conversation is persisted under a server-generated id, so the prologue seeded on the temporary id never carries over and the first answer rendered without it. Hydrate the real session id from the server list before appending the question, so the ordering doesn't trip the streaming authority check and wipe the just-appended question and placeholder. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe send-message flow now hydrates non-empty server messages with UUIDs before appending a new question. The callback dependency list includes ChangesChat message hydration
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This change hydrates the server-created conversation before adding the first question so the initial prologue and answer render correctly; no actionable merge-blocking risk remains beyond normal checks. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wangq8
left a comment
There was a problem hiding this comment.
Thanks for the fix — the root cause is correctly identified: for a freshly created conversation the store session is keyed on the server-generated id, so the prologue seeded on the temporary id is orphaned and the first render drops it. Hydrating from currentMessages (which carries the server-seeded prologue) before appendQuestion is the right ordering, and the currentMessages.length > 0 guard correctly scopes this to the new-conversation path (existing conversations return an empty list).
A few notes:
-
Ordering vs. authority check — correct.
hydrateFromServerrejects a server list shorter than the local one, so hydrating afterappendQuestionwould either wipe the just-appended question/placeholder or be rejected. Doing it first leaves the session at[prologue, question, placeholder], so the latersingle-chat-boxhydration (where the server still returns only the prologue) is correctly rejected instead of truncating. 👍 -
Merge conflicts —
gh pr viewreportsmergeable: CONFLICTING. Please rebase onmainand resolve before merge. -
Missing test — this store has subtle length/authority-guard logic. A regression test covering "new conversation hydrates the server prologue before appending the question, and the question isn't wiped by a subsequent stale server list" would be valuable. None is included here.
-
Minor —
buildMessageListWithUuidalsoomitsreference; harmless for the prologue, but the helper does more than its name suggests. Non-blocking.
LGTM once the conflicts are resolved.
Summary
fix(web): seed new conversation from server prologue before appending question
A freshly created conversation is persisted under a server-generated id, so the prologue seeded on the temporary id never carries over and the first answer rendered without it. Hydrate the real session id from the server list before appending the question, so the ordering doesn't trip the streaming authority check and wipe the just-appended question and placeholder.