Keep chat turns in the order they were sent #138

Merged
westfarn merged 1 commits from fix/136-message-order into master 2026-10-25 06:05:28 -07:00
Owner

Summary

  • Closes #136.
  • Chat turns are sorted oldest-first by created, then id, whenever they are written into state. A scrambled conversation_details payload no longer redraws the thread backwards after the reply lands.
  • START_OF_THE_STREAM no longer copies the websocket closure into the message ref. That copy could drop the optimistic turn and let END rebuild the thread from the previous list.
  • Optimistic bubbles use a stable local key so they do not collide with a server id.
  • The account toggle is labeled "Remember this chat" and defaults on, matching chat_backend#84.

Test plan

  • CI=true npm test -- --watchAll=false --testPathPattern='promptOrder|MessageContext|data.test'
  • Ask for a joke, then "I don't know, why?". While it works, order stays: joke request, joke, follow-up, status. After the reply, the follow-up stays under the joke and the new answer is last, with the action row on that answer.
  • Reload the conversation. Order stays the same.
  • Send another follow-up. It appends at the bottom.
  • Needs chat_backend#84 (or that branch) for the reply to actually use the previous turn.
## Summary - Closes #136. - Chat turns are sorted oldest-first by `created`, then id, whenever they are written into state. A scrambled `conversation_details` payload no longer redraws the thread backwards after the reply lands. - `START_OF_THE_STREAM` no longer copies the websocket closure into the message ref. That copy could drop the optimistic turn and let `END` rebuild the thread from the previous list. - Optimistic bubbles use a stable local key so they do not collide with a server id. - The account toggle is labeled "Remember this chat" and defaults on, matching chat_backend#84. ## Test plan - [ ] `CI=true npm test -- --watchAll=false --testPathPattern='promptOrder|MessageContext|data.test'` - [ ] Ask for a joke, then "I don't know, why?". While it works, order stays: joke request, joke, follow-up, status. After the reply, the follow-up stays under the joke and the new answer is last, with the action row on that answer. - [ ] Reload the conversation. Order stays the same. - [ ] Send another follow-up. It appends at the bottom. - [ ] Needs chat_backend#84 (or that branch) for the reply to actually use the previous turn.
westfarn added 1 commit 2026-10-25 06:04:26 -07:00
Keep chat turns in the order they were sent.
Unit Tests / test (pull_request) Successful in 13s
bb104fffb9
The post-reply refetch and the stream-start ref copy could redraw bubbles out of order.

Closes #136.
westfarn merged commit ae59c2731d into master 2026-10-25 06:05:28 -07:00
westfarn deleted branch fix/136-message-order 2026-10-25 06:05:28 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_web_app#138