Skip to content

ep: Fix cursor marker leak due to edit splitting in V4 API - #60110

Merged
probably-neb merged 2 commits into
mainfrom
push-qwyqzvyuywuy
Jun 29, 2026
Merged

ep: Fix cursor marker leak due to edit splitting in V4 API#60110
probably-neb merged 2 commits into
mainfrom
push-qwyqzvyuywuy

Conversation

@probably-neb

@probably-neb probably-neb commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Objective

Closes EP-202

Prevent V4 edit predictions from leaking <|user_cursor|> markers into users' buffers.

Solution

  • Strip cursor marker text from emitted prediction edits, including when text_diff splits the marker across edit fragments.
  • Preserve literal marker-like text that already exists in the buffer.

Testing

  • cargo test -p edit_prediction prediction_edits_for_single_file_diff -- --nocapture
  • cargo test -p edit_prediction --lib
  • cargo fmt --check

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 29, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 29, 2026
@probably-neb
probably-neb enabled auto-merge June 29, 2026 19:00
@probably-neb
probably-neb added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 29faf94 Jun 29, 2026
61 checks passed
@probably-neb
probably-neb deleted the push-qwyqzvyuywuy branch June 29, 2026 19:07
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…tries#60110)

# Objective

Closes EP-202

Prevent V4 edit predictions from leaking `<|user_cursor|>` markers into
users' buffers.

## Solution

- Strip cursor marker text from emitted prediction edits, including when
`text_diff` splits the marker across edit fragments.
- Preserve literal marker-like text that already exists in the buffer.

## Testing

- `cargo test -p edit_prediction prediction_edits_for_single_file_diff
-- --nocapture`
- `cargo test -p edit_prediction --lib`
- `cargo fmt --check`

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants