fix(web): a new chat starts its own thread instead of appending to Myra's last one (CL-8616) - #955
Merged
Merged
Conversation
…ra's last one (CL-8616)
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.
Summary
A chat's route id used to be the agent's definition asset id, so
listChats/readChatinapps/web/src/chat/threads-api.tsgrouped every mail turn to that agent's address set into one conversation. Starting a chat from/chats/newsent a fresh, non-reply message, but the chats list still filed it under the agent's single existing entry, so a new question showed up appended under whatever conversation was already there.The chat id is now the thread's root turn id (
Sent:<uid>of the person's opening send), found by walking each turn's In-Reply-To/References back to a turn with no known parent (threadRootIds).listChatsgroups by that root instead of by agent, andreadChatresolves a chat's rows and its agent from the thread rather than from an agent lookup.startChatreturns the new root id from the send's own accepted response instead of the agent's asset id.chat-thread-page.tsx's agent avatar now keys offchat.agent.idinstead of the (now thread-scoped)chat.id. Updateddocs/chat-mail-threading.mdto describe the new keying.Testing
bun run check(typecheck, lint, fmt, test) passes from the worktree root.apps/web/src/chat/threads-api.test.tsfixture for the newMailTurn.parentIdfield.