Fix Stopped flush: turn-scoped request_id, only flush current turn#34
Merged
lukemarsden merged 1 commit intomainfrom Apr 3, 2026
Merged
Conversation
Two fixes to prevent response_entries leaking across interactions: 1. Capture request_id when the turn starts (first assistant entry), use it for the Stopped flush and message_completed instead of the global THREAD_REQUEST_MAP. This prevents a race where a follow-up or interrupt message updates the global request_id before the old turn's Stopped handler runs, causing old entries to be tagged with the new request_id. 2. Only flush entries from the current turn (after the last UserMessage), not the entire thread history. Previous turns' entries are already persisted and don't need re-sending. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lukemarsden
added a commit
to helixml/helix
that referenced
this pull request
Apr 3, 2026
Points to helixml/zed#34 which fixes response_entries leaking across interactions during follow-ups and interrupts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
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
request_idwhen a turn starts (first assistant entry), use it for the Stopped flush andmessage_completedinstead of the globalTHREAD_REQUEST_MAPUserMessage), not the entire thread historyWhy
Follow-up to #33. When a follow-up message or interrupt arrives before the old turn's
Stoppedhandler fires, the globalrequest_idhas already been updated. The flush then tags old entries with the newrequest_id, causing them to leak into the wrong interaction'sresponse_entries.Test plan
zed-agentandclaude(all phases including interrupt)response_entriesleaked across interactions)🤖 Generated with Claude Code