Skip to content

Fix hydrateMessages silently dropping user messages - #8442

Open
cstns wants to merge 1 commit into
mainfrom
fix-hydrate-messages-user-drop
Open

Fix hydrateMessages silently dropping user messages#8442
cstns wants to merge 1 commit into
mainfrom
fix-hydrate-messages-user-drop

Conversation

@cstns

@cstns cstns commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Found while building the onboarding surface, but this is shipped behaviour: hydrateMessages in the product-expert store rehydrates a saved transcript with a switch (true), which matches cases by strict equality. The isUserMessage predicate returned hasOwnProperty && message.query, which evaluates to the query string rather than a boolean, so it never strictly equals true and every user message is silently skipped. The AI branch only works because Array.isArray happens to return a real boolean.

In practice this means the editor to platform conversation handoff (wakeUpAssistant with shouldHydrateMessages) rebuilds the transcript with the assistant's answers but none of the user's messages.

Both predicates now return actual booleans, with a comment explaining why that matters, plus a regression spec that hydrates a mixed transcript and asserts the message sequence.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.77%. Comparing base (4d85e86) to head (95eb61a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8442   +/-   ##
=======================================
  Coverage   76.77%   76.77%           
=======================================
  Files         460      460           
  Lines       24703    24703           
  Branches     6573     6573           
=======================================
  Hits        18966    18966           
  Misses       5737     5737           
Flag Coverage Δ
backend 76.77% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cstns
cstns force-pushed the fix-hydrate-messages-user-drop branch from ed6a133 to 95eb61a Compare September 7, 2026 15:04
@cstns
cstns requested a review from andypalmi September 8, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant