Skip to content

Copilot CLI in workspace isolation mode stages all repo changes via git add -A -- . #306173

@chiyang10000

Description

@chiyang10000

Extension version

GitHub Copilot Chat 0.40.1

Environment

  • VS Code remote / VS Code Server session on Linux
  • Git 2.43.0

Problem

When I invoke Copilot CLI from Copilot Chat in workspace isolation mode (that is, no worktree is created), the extension stages all current repository changes after the request completes.

This results in previously unstaged tracked and untracked files becoming staged, even though I did not ask Copilot to prepare a commit.

Steps to reproduce

  1. Open any Git repository with unstaged changes.
  2. Start a Copilot Chat / Copilot CLI session in workspace isolation mode.
  3. Let the request complete.
  4. Check Git status.

Expected behavior

Copilot Chat / Copilot CLI should not stage repository changes in workspace mode unless the user explicitly requests a staging or commit action.

Actual behavior

All current changes are staged, equivalent to:

git add -A -- .

Evidence

I could consistently correlate these behaviors:

  • GitHub Copilot Chat.log showed:
    • Workspace isolation mode selected ... skipping worktree creation
  • vscode.git/Git.log immediately showed:
    • > git add -A -- .

I also traced the relevant code paths in the installed extensions:

  • Copilot Chat calls ChatSessionWorkspaceFolderService.handleRequestCompleted(...)
  • that calls this.gitService.add(folderUri, [])
  • Copilot Chat's GitServiceImpl.add(...) forwards to the VS Code Git API
  • VS Code Git's repository.add([]) resolves to git add -A -- .

So it looks like add([]) in the workspace-mode completion path is effectively interpreted as stage everything.

Notes

This appears separate from the worktree / auto-commit flow. In my case the session was running in workspace mode, and I observed the staging behavior even without a subsequent git commit.

Please let me know if you'd like a more detailed repro or sanitized log excerpts.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions