An active tab is not a conversation key
A delayed response can return after the user opens another chat. If the callback appends to the currently visible message array, the answer lands in the wrong conversation. Editing and branching also require more context than a project-level conversation ID alone.
What to do next
- 01
Create the pending turn
Persist the conversation ID, parent message, user message version and submitted history snapshot before dispatch. Reserve an assistant-result association for that turn so both immediate and deferred response paths have the same destination.
- 02
Attach through saved identity
When the answer arrives, update the persisted pending turn by its identity, not the currently selected conversation. A user edit should create a new branch or turn according to your product policy rather than mutate the history that produced the pending answer.
- 03
Test navigation and branching
Switch conversations while a response is held, edit an earlier user message and then release the response. Confirm the answer remains on its original branch, with the newer branch's state and unread indicator behaving deliberately.
A concrete example
Illustrative example: turn T9 belongs to conversation A. The user opens B before T9 completes. The answer is stored under A/T9 and can create an unread indicator, while B's message history remains untouched.
Before you call it ready
- Responses name a persisted turn.
- Edited history creates explicit branch semantics.
- Deferred chat follows the same association.
When to stop or choose another method
Stop appending answers to the currently open message list without checking the saved conversation and turn identity that initiated the request.
