[diffs/edit] Add edit prediction support - #1024
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 303ba7f574
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
still working on it |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a4640848f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!isGithubAuthenticated(request)) { | ||
| return createErrorResponse('GitHub sign-in required.', 401); |
There was a problem hiding this comment.
Rate-limit authenticated prediction requests
Any GitHub account that obtains this session cookie can issue unlimited concurrent POST requests, and every accepted request is forwarded using the site's shared Mistral API key. A caller can therefore exhaust the upstream quota or incur substantial usage before Mistral's account-wide 429 response intervenes; enforce a per-user/session and concurrency limit before calling Codestral.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
added vercel rate limit
| prediction.response.edits[editIndex - 1]?.range.end.line !== | ||
| start.line && | ||
| prediction.response.edits[editIndex + 1]?.range.start.line !== | ||
| start.line |
There was a problem hiding this comment.
Compose multiple same-line edits before previewing
When a valid response contains two non-overlapping insertions on the same source line, these neighbor checks suppress suffix reconstruction for both overlays, while the earlier #renderSelection calls mask the in-flow suffix from each insertion point. The preview consequently drops unchanged source text even though accepting the prediction preserves it; compose the edits into one post-edit line for rendering or reject same-line edit combinations.
Useful? React with 👍 / 👎.
| return; | ||
| } | ||
| if (isPromise(result)) { | ||
| if (result instanceof Promise) { |
There was a problem hiding this comment.
Detect asynchronous storage results across realms
If a custom persistStateStorage returns a Promise created in another window or iframe, result instanceof Promise is false even though the value satisfies the public Promise return type. The restore path then treats that Promise as an EditorState and applies an empty state, while the analogous write check also stops tracking write ordering; retain a realm-independent thenable check or normalize with Promise.resolve.
Useful? React with 👍 / 👎.
|
@codex review again |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dae253f656
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Cross-line edits cannot share their boundary line with another | ||
| // preview overlay. | ||
| if (renderEdits.at(-1)?.range.end.line === line) { | ||
| return; |
There was a problem hiding this comment.
Support valid edits that share a boundary line
When one non-overlapping edit crosses into a line and the next edit starts later on that same line—for example, {0,2}->{1,0} followed by {1,1}->{1,2}—the previous render edit ends on line, so this branch returns from the response handler. The public provider contract permits non-overlapping edit batches, but this valid response is silently discarded: no preview appears and Tab cannot accept it. Compose the boundary-line overlays or otherwise render the batch without rejecting it.
Useful? React with 👍 / 👎.
Screen.Recording.2026-07-25.at.02.18.26.mov
Usage: