Repository navigation
fix(studio): reconcile externally updated saved assistant messages - #11500
Merged
danielhanchen merged 4 commits intoOct 2, 2026
Merged
danielhanchen merged 4 commits into
danielhanchen merged 4 commits into
Conversation
When another client updates an assistant message through the history API, wake triggers now merge the persisted body into the open thread without overwriting active generations, in-progress streams, or edits in flight.
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 1, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 1, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 1, 2026
danielhanchen
pushed a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Oct 1, 2026
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.
Fixes #11496
Problem
When an external client updates an existing assistant message via
PUT /api/chat/threads/{threadId}/messages, Studio could fetch the newer history on wake (visibilitychange,pageshow,online) but only ran generation recovery for messages withmetadata.generationRunId. Ordinary saved assistant turns stayed stale in the open runtime.Solution
recoveredContentToImport(no write-back to storage).windowfocuswhile the document is visible.Tests
studio/frontend/tests/saved-history-reconciliation.test.ts(6 cases)Before / after
Seeded thread: user "Hi" plus an ordinary assistant reply "Old checkpoint" (no
generationRunId). The thread is opened in Studio, then the same assistant record is updated throughPUT /api/chat/threads/{id}/messages(pruneMissing: false), then the page is woken.Wake via
visibilitychange+focus+pageshowafter saving "New saved checkpoint". Left is the merge base, right is this PR:A second save of "Newest via focus", woken by a lone
windowfocusevent:In both cases the server held the new text on both sides; only the open view differed.
Captured with the PR at
1bc02fc2bagainst merge basec0a60448e. The same pair reproduces in Firefox and WebKit.