Skip to content

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Jan 12, 2026

Description

Wait for the previous edit tool to create its diff in the IDE before the next edit tool.
This caused race conditions because the code required the text editor to be active for the diff to be streamed into the proper file.

resolves CON-5048

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Continue Tasks

Status Task Actions
▶️ Queued Update docs on PR View

Powered by Continue


Summary by cubic

Prevent race conditions when multiple edit tools apply diffs at the same time by targeting the correct file editor. Each diff now streams to the right file without relying on the active editor.

  • Bug Fixes
    • Require filepath in ApplyToFilePayload.
    • Open and use the specific editor via openEditorAndRevealRange; stop relying on activeTextEditor.
    • Pass filepath through instantApplyDiff to apply diffs to the correct file (CON-5048).

Written for commit 4d4211f. Summary will update on new commits.

@uinstinct uinstinct requested a review from a team as a code owner January 12, 2026 15:49
@uinstinct uinstinct requested review from sestinj and removed request for a team January 12, 2026 15:49
@continue-staging
Copy link

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

1 similar comment
@continue
Copy link
Contributor

continue bot commented Jan 12, 2026

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 12, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="gui/src/redux/thunks/handleApplyStateUpdate.ts">

<violation number="1" location="gui/src/redux/thunks/handleApplyStateUpdate.ts:172">
P1: Concurrent apply thunks can deadlock: the wait loop counts the current not-started apply state, so two simultaneous calls both wait forever and never call applyToFile.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a more deterministic approach we could take to queuing these diffs?

My concern is that 1000 ms is kind of long so in the case a diff stopped streaming just after it checks (1000 ms till next check) and then someone starts clicking around it would suddenly start streaming and feel glitchy?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jan 18, 2026
@uinstinct
Copy link
Contributor Author

Is there a more deterministic approach we could take to queuing these diffs?

My concern is that 1000 ms is kind of long so in the case a diff stopped streaming just after it checks (1000 ms till next check) and then someone starts clicking around it would suddenly start streaming and feel glitchy?

True. It need not be 1000 ms. I added that as an approximate - but most diffs resolve faster. Will put 100 ms instead.

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uinstinct I think we should consider more predictable routes to applying the diffs in order, there are other issues with this approach e.g. selectApplyStatesInProgress could potentially detect some stale apply states which were ignored in a previous session etc and then it would never apply the diff

Let's avoid polling if possible and implement some kind of predictable queue.

@uinstinct
Copy link
Contributor Author

@uinstinct I think we should consider more predictable routes to applying the diffs in order, there are other issues with this approach e.g. selectApplyStatesInProgress could potentially detect some stale apply states which were ignored in a previous session etc and then it would never apply the diff

Let's avoid polling if possible and implement some kind of predictable queue.

implemented a new method to rely on getting the filepath's editor without opening activeTextEditor

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 22, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="extensions/vscode/src/diff/vertical/manager.ts">

<violation number="1" location="extensions/vscode/src/diff/vertical/manager.ts:308">
P2: instantApplyDiff now assumes `filepath` is already a URI string; passing a filesystem path breaks handler creation and map lookups because `Uri.parse` and `fileUriToCodeLens` keys won’t match the editor’s file:// URI.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@uinstinct uinstinct requested a review from RomneyDa January 23, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants