Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 22, 2025

Overview

This PR enhances the Copilot Cloud Chat Session Provider to provide a better user experience when local git changes are detected. Instead of blocking with an error message, users are now prompted to either commit their changes and continue, or cancel the request.

Problem

Previously, when a user attempted to delegate work to the cloud agent with uncommitted changes in their workspace, the system would immediately fail with an error message:

"Uncommitted changes detected. Please commit, stash, or discard your changes before delegating work to the cloud agent."

This required users to:

  1. Cancel their cloud agent request
  2. Manually commit or stash their changes
  3. Re-initiate the cloud agent request

This workflow was disruptive and added unnecessary friction to the user experience.

Solution

The cloud agent now detects uncommitted changes and presents an interactive modal dialog with two options:

  • Commit and Continue - Automatically stages all changes, commits them with a meaningful message ("WIP: Changes for cloud agent task"), pushes to the remote, and proceeds with the cloud agent task
  • Cancel - Cancels the cloud agent request, allowing users to handle changes manually

User Experience Flow

  1. User delegates work to cloud agent with uncommitted changes
  2. Modal dialog appears explaining the situation
  3. If user chooses "Commit and Continue":
    • Progress message: "Committing local changes"
    • System stages and commits all changes
    • Progress message: "Pushing changes to remote"
    • System pushes to remote branch
    • Continues with cloud agent workflow
  4. If user chooses "Cancel":
    • Request is cancelled gracefully
    • User retains full control of their changes

Technical Details

Modified File: src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

  • Replaced blocking error with interactive showWarningMessage modal
  • Added automatic git operations using VS Code's Git Extension API:
    • repo.add() to stage changes
    • repo.commit() to create commit
    • repo.push() to push to remote
  • Added telemetry event copilot.codingAgent.uncommittedChanges to track user decisions
  • Proper error handling with user-friendly messages if git operations fail
  • Progress feedback during commit/push operations

Benefits

Seamless workflow - Users can continue with their task without context switching
User choice - Users maintain control over whether to commit or cancel
Transparency - Clear progress messages inform users what's happening
Safety - Proper error handling ensures users are informed if operations fail
Telemetry - User decisions are tracked to understand usage patterns

Testing

  • ✅ Compilation passes (npm run compile)
  • ✅ Type checking passes (npm run typecheck)
  • ✅ Linting passes (npm run lint)
  • ✅ Code formatting verified with tsfmt
Original prompt

I want to make the copilot cloud chat session provider to be able to detect when there are local git changes and prompt the user to either commit them and continue or cancel the request before delegating to the remote coding agent


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Replace blocking error with interactive modal prompt when uncommitted changes detected
- Allow users to choose 'Commit and Continue' or 'Cancel'
- Automatically stage, commit, and push changes when user chooses to continue
- Add telemetry to track user decisions
- Update progress messages to inform user of commit/push operations
Copilot AI changed the title [WIP] Add local git changes detection and user prompt Add interactive prompt for uncommitted changes in cloud agent workflow Oct 22, 2025
Copilot AI requested a review from osortega October 22, 2025 01:08
Copilot finished work on behalf of osortega October 22, 2025 01:08
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.

2 participants