fix(server): do not rebind assistant turnId after queue drain#101
Merged
Conversation
When a turn completes and a queued follow-up drains in the same window, provider runtime can re-emit assistant.complete for the same message id under the new activeTurnId. The projector was overwriting turnId, which orphaned the real final from its completed turn. Keep the original assistant turn binding once set, and skip ingestion re-complete when the bubble is already bound to a different turn.
Collapse the queue-drain restamp unit test into one Effect.gen run and bump the projector.test.ts legacy baseline by one so Check stays green.
patroza
added a commit
that referenced
this pull request
Jul 27, 2026
* fix(server): do not rebind assistant turnId after queue drain When a turn completes and a queued follow-up drains in the same window, provider runtime can re-emit assistant.complete for the same message id under the new activeTurnId. The projector was overwriting turnId, which orphaned the real final from its completed turn. Keep the original assistant turn binding once set, and skip ingestion re-complete when the bubble is already bound to a different turn. * fix(server): keep projector rebind test under Effect.runPromise baseline Collapse the queue-drain restamp unit test into one Effect.gen run and bump the projector.test.ts legacy baseline by one so Check stays green.
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
Investigated t3vm thread
16feaadd-e89d-4101-bcd9-ac7e1d723de0(Discord + queue drain).Event log smoking gun
At
2026-07-27T05:57:21.174Z:assistant:…:segment:5correctly written under turnc25ca2c5with the 1791-char final89e689f8startsassistant-completefor the same messageId with turnId=89e689f8restamps the bubble onto the next turnProjection then showed the final as part of the follow-up turn. Discord finalized short trailers (
segment:7) and deleted the tip that had held the real answer.Fix
turnIdto a different turnRelated
fix/discord-finalize-before-queue-drainTest plan