copilot: Fix panic in Copilot edit prediction due to anchor/snapshot mismatch#46022
Merged
Veykril merged 2 commits intozed-industries:mainfrom Jan 4, 2026
Merged
Conversation
When `trim_completion()` creates new anchors from the current buffer state, `completion.snapshot` was not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic in `interpolate_edits()` when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed. The fix ensures that `completion.snapshot` is updated whenever new anchors are created in `trim_completion()`, keeping the snapshot and anchors consistent. Fixes zed-industries#45956
Closed
Member
|
rustfmt is not happy |
Contributor
Author
One moment, I'll fix this. I executed |
Member
|
Looks good now, thanks! not sure what went wrong for you there unfortunatley |
Member
|
Thank you! |
rtfeldman
pushed a commit
that referenced
this pull request
Jan 5, 2026
…mismatch (#46022) When `trim_completion()` creates new anchors from the current buffer state, `completion.snapshot` was not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic in `interpolate_edits()` when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed. The fix ensures that `completion.snapshot` is updated whenever new anchors are created in `trim_completion()`, keeping the snapshot and anchors consistent. Closes #45956 Release Notes: - Fixed a panic in Copilot edit predictions caused by anchor/snapshot version mismatch
LivioGama
pushed a commit
to LivioGama/zed
that referenced
this pull request
Jan 20, 2026
…mismatch (zed-industries#46022) When `trim_completion()` creates new anchors from the current buffer state, `completion.snapshot` was not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic in `interpolate_edits()` when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed. The fix ensures that `completion.snapshot` is updated whenever new anchors are created in `trim_completion()`, keeping the snapshot and anchors consistent. Closes zed-industries#45956 Release Notes: - Fixed a panic in Copilot edit predictions caused by anchor/snapshot version mismatch
LivioGama
pushed a commit
to LivioGama/zed
that referenced
this pull request
Jan 20, 2026
…mismatch (zed-industries#46022) When `trim_completion()` creates new anchors from the current buffer state, `completion.snapshot` was not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic in `interpolate_edits()` when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed. The fix ensures that `completion.snapshot` is updated whenever new anchors are created in `trim_completion()`, keeping the snapshot and anchors consistent. Closes zed-industries#45956 Release Notes: - Fixed a panic in Copilot edit predictions caused by anchor/snapshot version mismatch
LivioGama
pushed a commit
to LivioGama/zed
that referenced
this pull request
Feb 15, 2026
…mismatch (zed-industries#46022) When `trim_completion()` creates new anchors from the current buffer state, `completion.snapshot` was not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic in `interpolate_edits()` when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed. The fix ensures that `completion.snapshot` is updated whenever new anchors are created in `trim_completion()`, keeping the snapshot and anchors consistent. Closes zed-industries#45956 Release Notes: - Fixed a panic in Copilot edit predictions caused by anchor/snapshot version mismatch
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.
When
trim_completion()creates new anchors from the current buffer state,completion.snapshotwas not being updated, leaving it with the older snapshot from when the prediction was initially fetched. This caused a panic ininterpolate_edits()when trying to resolve anchors with Lamport timestamps newer than what the old snapshot had observed.The fix ensures that
completion.snapshotis updated whenever new anchors are created intrim_completion(), keeping the snapshot and anchors consistent.Closes #45956
Release Notes: