feat: implement GitHub pull request operations in agent host#318256
Draft
DonJayamanne wants to merge 5 commits into
Draft
feat: implement GitHub pull request operations in agent host#318256DonJayamanne wants to merge 5 commits into
DonJayamanne wants to merge 5 commits into
Conversation
- Refactor ProtocolServerHandler to delegate changeset operations to the agent service. - Introduce AgentHostOctoKitService for minimal GitHub REST client functionality. - Add tests for AgentHostPullRequestOperationHandler to ensure correct behavior for creating and managing pull requests. - Enhance session test helpers to support new Git operations. - Update logging and connection handling to include changeset operation invocation. - Ensure proper handling of GitHub API responses and error cases in tests.
f0f41a8 to
f5692fd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end support for invoking GitHub pull request–related “changeset operations” from the agent host, including a minimal GitHub REST client, git plumbing for committing/pushing, and operation contribution/handler wiring so the protocol server can delegate operation execution to the agent service.
Changes:
- Route
invokeChangesetOperationthroughAgentServiceand introduce a contribution/handler registry for changeset operations. - Add a minimal agent-host GitHub REST client (
AgentHostOctoKitService) plus PR operation contribution/handler to create/reuse PRs. - Extend agent-host git service with
commitAll,hasUpstream, andpushBranch, and add focused unit tests for the new behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts | Exposes invokeChangesetOperation on the workbench-side agent host service client. |
| src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts | Updates terminal agent-host mock to include the new invokeChangesetOperation API. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts | Logs calls/results for invokeChangesetOperation through the logging wrapper. |
| src/vs/platform/agentHost/test/node/shared/agentHostOctoKitService.test.ts | Adds unit tests for the minimal GitHub REST client behavior/error handling. |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Updates protocol server handler test mocks for new IAgentService surface. |
| src/vs/platform/agentHost/test/node/copilotGitProject.test.ts | Updates git service test double with new git methods. |
| src/vs/platform/agentHost/test/node/copilotAgent.test.ts | Updates git service test double with new git methods. |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Adds coverage for storing/retrieving the GitHub repo token via AgentService. |
| src/vs/platform/agentHost/test/node/agentHostPullRequestOperationProvider.test.ts | Tests PR operation advertisement/hiding logic for GitHub-backed sessions. |
| src/vs/platform/agentHost/test/node/agentHostPullRequestOperationHandler.test.ts | Tests PR operation handler flow: commit, push, reuse/create PR, cancellation, and error recovery. |
| src/vs/platform/agentHost/test/common/sessionTestHelpers.ts | Extends noop git service helper with new git methods. |
| src/vs/platform/agentHost/node/shared/agentHostOctoKitService.ts | Introduces minimal GitHub REST client for PR creation/lookup in agent host. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Delegates invokeChangesetOperation to AgentService instead of inline validation/no-handler error. |
| src/vs/platform/agentHost/node/agentService.ts | Adds auth token cache + changeset operation contribution service + git-state service integration. |
| src/vs/platform/agentHost/node/agentHostSessionGitStateService.ts | Extracts git-state attach/refresh + changeset catalogue decoration into a dedicated service. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Registers IAgentService in the agent-host server DI collection. |
| src/vs/platform/agentHost/node/agentHostPullRequestOperationProvider.ts | Adds PR operation contribution: advertises “Create PR” operations and hides them optimistically after creation. |
| src/vs/platform/agentHost/node/agentHostPullRequestOperationHandler.ts | Implements server-side PR creation handler: commit, push, find existing PR, create PR, return follow-up. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Registers IAgentService in the main agent-host DI collection. |
| src/vs/platform/agentHost/node/agentHostGitService.ts | Adds commitAll, hasUpstream, and pushBranch to support PR creation workflow. |
| src/vs/platform/agentHost/node/agentHostChangesetOperationContributionService.ts | New service managing contributions + operation handler registration + invocation validation/dispatch. |
| src/vs/platform/agentHost/node/agentHostChangesetOperationContributions.ts | Registers default operation contributions (currently PR operations). |
| src/vs/platform/agentHost/electron-browser/localAgentHostService.ts | Adds invokeChangesetOperation to the local IPC proxy client. |
| src/vs/platform/agentHost/common/changesetOperation.ts | Defines common interfaces for operation contributions/handlers/registry/service. |
| src/vs/platform/agentHost/common/agentService.ts | Adds GITHUB_REPO_PROTECTED_RESOURCE, getAuthToken, and invokeChangesetOperation to the shared API. |
| src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts | Adds the JSON-RPC request plumbing for invokeChangesetOperation. |
| src/vs/platform/agentHost/browser/nullAgentHostService.ts | Adds a not-supported stub for invokeChangesetOperation. |
Copilot's findings
- Files reviewed: 27/27 changed files
- Comments generated: 2
…RequestOperationProvider
DonJayamanne
commented
May 26, 2026
| * handlers) that need bearer tokens for resources not tied to a | ||
| * specific agent — typically {@link GITHUB_REPO_PROTECTED_RESOURCE}. | ||
| */ | ||
| getAuthToken(resource: string): string | undefined; |
Contributor
Author
There was a problem hiding this comment.
Auth token changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #317113