Skip to content

feat: Implement session Git state management and commit operations#318734

Merged
DonJayamanne merged 4 commits into
mainfrom
agents/have-a-look-at-all-of-the-changes-a1c7e1d2
Jun 4, 2026
Merged

feat: Implement session Git state management and commit operations#318734
DonJayamanne merged 4 commits into
mainfrom
agents/have-a-look-at-all-of-the-changes-a1c7e1d2

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

@DonJayamanne DonJayamanne commented May 28, 2026

Fixes #317921

  • Added AgentHostSessionGitStateService to manage Git state during agent sessions.
  • Integrated Git state probing into AgentService for session lifecycle management.
  • Introduced commit operation handling in AgentHostCommitOperationHandler to commit changes and refresh changesets.
  • Enhanced AgentService to store authentication tokens for GitHub Copilot.
  • Updated tests to cover new commit operation functionality and Git state management.
  • Refactored existing code to utilize the new session Git state service and commit operations.

Copilot AI review requested due to automatic review settings May 28, 2026 11:54
Copy link
Copy Markdown
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 adds server-side changeset operations for agent-host sessions, with a commit operation backed by Git state probing and Copilot-generated commit messages.

Changes:

  • Extracts session Git state probing into AgentHostSessionGitStateService.
  • Adds a changeset operation contribution framework and a commit operation handler/provider.
  • Extends agent-host connection interfaces, clients, DI wiring, and tests for the new operation flow.
Show a summary per file
File Description
src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts Delegates changeset operation invocation through the editor remote client.
src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts Updates mock agent connection for the new interface method.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts Adds logging wrapper support for changeset operation calls.
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts Updates mock agent service for new auth and operation APIs.
src/vs/platform/agentHost/test/node/copilotGitProject.test.ts Updates Git service test double for new Git methods.
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Updates Git service test double for new Git methods.
src/vs/platform/agentHost/test/node/agentService.test.ts Adds token-caching coverage and updates Git service stubs.
src/vs/platform/agentHost/test/node/agentHostCommitOperationProvider.test.ts Adds coverage for commit operation advertisement logic.
src/vs/platform/agentHost/test/node/agentHostCommitOperationHandler.test.ts Adds coverage for commit handler success, clean tree, and cancellation paths.
src/vs/platform/agentHost/test/common/sessionTestHelpers.ts Updates no-op Git service helper for the expanded interface.
src/vs/platform/agentHost/node/protocolServerHandler.ts Delegates invokeChangesetOperation to AgentService.
src/vs/platform/agentHost/node/agentService.ts Wires Git state service, operation contributions, token caching, and invocation dispatch.
src/vs/platform/agentHost/node/agentHostSessionGitStateService.ts Adds dedicated service for session Git state probing and changeset catalogue updates.
src/vs/platform/agentHost/node/agentHostServerMain.ts Registers IAgentService in server DI scope.
src/vs/platform/agentHost/node/agentHostMain.ts Registers IAgentService in local agent-host DI scope.
src/vs/platform/agentHost/node/agentHostGitService.ts Adds Git commit, upstream detection, and push helpers.
src/vs/platform/agentHost/node/agentHostCommitOperationProvider.ts Adds commit operation contribution for uncommitted changesets.
src/vs/platform/agentHost/node/agentHostCommitOperationHandler.ts Implements commit operation execution and Copilot commit message generation.
src/vs/platform/agentHost/node/agentHostChangesetOperationContributionService.ts Adds contribution registry, operation refresh, validation, and dispatch.
src/vs/platform/agentHost/node/agentHostChangesetOperationContributions.ts Registers default changeset operation contributions.
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts Delegates local changeset operation invocation.
src/vs/platform/agentHost/common/changesetOperation.ts Defines common changeset operation contribution interfaces.
src/vs/platform/agentHost/common/agentService.ts Extends agent service/connection interfaces for auth token retrieval and operation invocation.
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts Sends changeset operation requests over JSON-RPC.
src/vs/platform/agentHost/browser/nullAgentHostService.ts Adds unsupported stub for changeset operation invocation.

Copilot's findings

  • Files reviewed: 25/25 changed files
  • Comments generated: 3

Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentHostGitService.ts
Comment thread src/vs/platform/agentHost/node/agentHostCommitOperationHandler.ts Outdated
Copy link
Copy Markdown
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.

Copilot's findings

  • Files reviewed: 25/25 changed files
  • Comments generated: 1

Comment thread src/vs/platform/agentHost/node/agentHostSessionGitStateService.ts
@DonJayamanne DonJayamanne force-pushed the agents/have-a-look-at-all-of-the-changes-a1c7e1d2 branch 2 times, most recently from b410315 to ebf443d Compare May 29, 2026 00:49
@DonJayamanne DonJayamanne marked this pull request as ready for review May 29, 2026 02:35
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented May 29, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts

@DonJayamanne DonJayamanne force-pushed the agents/have-a-look-at-all-of-the-changes-a1c7e1d2 branch from b8672d5 to 78bbb50 Compare June 3, 2026 18:45
@DonJayamanne DonJayamanne enabled auto-merge (squash) June 3, 2026 19:30
Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentHostChangesetOperationContributionService.ts Outdated
Comment thread src/vs/platform/agentHost/common/changesetOperation.ts
Comment thread src/vs/platform/agentHost/common/changesetOperation.ts Outdated
Comment thread src/vs/platform/agentHost/common/changesetOperation.ts
@DonJayamanne DonJayamanne force-pushed the agents/have-a-look-at-all-of-the-changes-a1c7e1d2 branch from 32f5429 to 3d4edd7 Compare June 4, 2026 03:33
@DonJayamanne DonJayamanne requested a review from connor4312 June 4, 2026 03:49
readonly token: string;
}

export class AgentHostAuthenticationService {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can probably make this @Injectable and have consumers use this rather than adding stuff to the big agentService

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will fix,

@DonJayamanne DonJayamanne merged commit 305b74c into main Jun 4, 2026
39 of 40 checks passed
@DonJayamanne DonJayamanne deleted the agents/have-a-look-at-all-of-the-changes-a1c7e1d2 branch June 4, 2026 12:15
@vs-code-engineering vs-code-engineering Bot added this to the 1.124.0 milestone Jun 4, 2026
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.

Support Commit Operations in Chagesets and Changes View of Agent Window

3 participants