Skip to content

Conversation

@lszomoru
Copy link
Member

Copilot AI review requested due to automatic review settings January 19, 2026 09:41
@lszomoru lszomoru enabled auto-merge January 19, 2026 09:41
@lszomoru lszomoru self-assigned this Jan 19, 2026
@lszomoru lszomoru added this to the January 2026 milestone Jan 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where the background agent incorrectly passes an originalUri when creating a ChatSessionChangedFile for newly added files. When a file is added (status INDEX_ADDED), there is no original version to compare against, so the originalUri should be undefined.

Changes:

  • Added conditional logic to set originalUri to undefined when the git change status is INDEX_ADDED (value 1)
  • Applied the same fix in two code paths: one for uncommitted changes and one for committed changes
Comments suppressed due to low confidence (1)

src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts:290

  • Consider importing the Status enum from the git API and using Status.INDEX_ADDED instead of the magic number 1. This would make the code more maintainable and less prone to errors. The Status enum is available from the git extension API types.
				change.status !== 1 /* INDEX_ADDED */
					? toGitUri(change.originalUri, worktreeProperties.baseCommit)
					: undefined);

Comment on lines +262 to +264
change.status !== 1 /* INDEX_ADDED */
? change.originalUri
: undefined));
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

Consider importing the Status enum from the git API and using Status.INDEX_ADDED instead of the magic number 1. This would make the code more maintainable and less prone to errors. The Status enum is available from the git extension API types.

This issue also appears in the following locations of the same file:

  • line 288

Copilot uses AI. Check for mistakes.
@lszomoru lszomoru added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit c6d0c94 Jan 19, 2026
25 checks passed
@lszomoru lszomoru deleted the lszomoru/cloudy-scorpion branch January 19, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants