agentHost: Support typed repository source session creation - #336361
Draft
Osvaldo Ortega (osortega) wants to merge 4 commits into
Draft
Osvaldo Ortega (osortega) wants to merge 4 commits into
Osvaldo Ortega (osortega) wants to merge 4 commits into
Conversation
Consume the optional repository descriptor proposed in microsoft/agent-host-protocol#451. Forward selected repository intent through session configuration, leaving checkout preparation to the host and retaining legacy directory behavior when the descriptor is absent. Wait for repository readiness and resolved directories before sending a turn, rebind customization scopes, preserve local workspace trust, and verify repository intent when recovering an existing session. Render preparation progress without assuming download units. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4 tasks
Copilot started reviewing on behalf of
Osvaldo Ortega (osortega)
September 16, 2026 01:36
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Repository configuration authority, recovery validation, trust gating, and pre-validation reconciliation have correctness issues.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 4
Open (4)
What changed in this PR
Adds schema-driven repository session creation through the Agent Host Protocol.
Changes:
- Discovers repository URL/revision fields and waits for checkout readiness.
- Rebinds customization scopes and validates checkout trust.
- Generalizes preparation progress and syncs protocol documentation/types.
| File | Description |
|---|---|
agentHostRepositoryConfig.test.ts |
Tests repository configuration and readiness. |
agentHostDownloadProgress.test.ts |
Tests generic progress messaging. |
agentHostChatContribution.test.ts |
Tests creation, recovery, trust, and customizations. |
agentHostSessionHandler.ts |
Integrates repository-backed creation lifecycle. |
agentHostRepositoryConfig.ts |
Implements schema discovery and readiness validation. |
agentHostDownloadProgress.ts |
Makes progress rendering operation-neutral. |
REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md |
Documents repository session lifecycle. |
channels-session/state.ts |
Adds repository schema metadata. |
channels-session/commands.ts |
Documents creation requirements. |
channels-root/notifications.ts |
Clarifies progress semantics. |
channels-root/commands.ts |
Exports and documents repository configuration. |
.ahp-version |
Updates the synchronized protocol revision. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (!confirmed || confirmed.urlProperty !== descriptor.urlProperty || confirmed.revisionProperty !== descriptor.revisionProperty) { | ||
| throw new Error(localize('agentHost.repositoryConfigChanged', "The agent host changed its repository configuration while resolving the session.")); | ||
| } | ||
| return { ...resolved.values, ...requested }; |
Comment on lines
+114
to
+119
| const revisionProperty = readRepositorySessionConfig(state.config?.schema)?.revisionProperty; | ||
| const expectedRevision = revisionProperty ? expectedConfig?.[revisionProperty] : undefined; | ||
| const actualRevision = revisionProperty ? state.config?.values[revisionProperty] : undefined; | ||
| if (state.lifecycle !== SessionLifecycle.Ready || !repository | ||
| || (expectedRepository && repository !== expectedRepository.toString()) | ||
| || (expectedRevision !== undefined && actualRevision !== expectedRevision) |
Comment on lines
+5611
to
+5612
| if (requestedDirectory?.scheme === Schemas.https && defaultScheme !== Schemas.https) { | ||
| const repositoryConfig = await resolveAgentHostRepositoryConfig(this._config.connection, this._config.provider, requestedDirectory, config, cancellationToken); |
| } | ||
|
|
||
| const rawState = this._requireRawSessionState(session.toString()); | ||
| const rawState = await waitForRepositorySessionReady(newSub, cancellationToken, repository, config); |
Use the host's re-resolved defaults after selecting a repository, rather than restoring defaults from the previous context. Preserve explicit user selections and add a regression test for removed and changed defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use repositorySource and repositoryRevision from advertised session configuration instead of a field-name descriptor. Preserve directory-only compatibility and requested intent through readiness and lost-response recovery, and reject unsupported explicit inputs. Sync the AHP contract from b6a62eba9b67cbe3252682e9d6a4255d3e1175c6. Keep the local integration UI patch outside this commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 79731f48-d288-483f-8809-136aa141d1eb
Contributor
|
Base:
|
Move repository intent out of provider config and carry typed source/revision fields through creation, queries, session metadata and recovery. Discover support through per-agent capabilities and reject unsupported native-host requests. Prepare source drafts on first send while preserving eager directory creation, trust checks and customization rebinding. Verify exact recovery intent, including an omitted revision. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 79731f48-d288-483f-8809-136aa141d1eb
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.

Summary and dependency
Support optional repository-backed session creation through the typed contract in microsoft/agent-host-protocol#451. The protocol mirror is pinned to
fa44ef3fae7c4750012024c106b70577e7a027c4.{ "repositorySource": "https://git.example.org/team/app.git", "repositoryRevision": "main", "config": { "mode": "interactive" } }Source and revision are top-level typed fields on creation and config queries, not entries in
config. They are also immutable session metadata, separate from host-resolved working directories. One source can resolve to several directories or different worktrees across sessions.Supersedes the closed #336294. This PR does not expose arbitrary RPC dispatch or implement a vendor cloning adapter.
Changes
capabilities.repositorySource;{}supports a source and{ "revision": true }also supports an explicit revision. No source config-key convention or property-name mapping remains.No new clone RPC, token-provisioning change, lifecycle state or protocol-version bump.
Reading order
Validation of
9c6764a395581406c761ca3b0a91870ff0a9d89dnpm run typecheck-clientandnpm run valid-layers-checkpassed.Scope and verification limits