agentHost: Use schema-driven repository session creation - #336361
Draft
Osvaldo Ortega (osortega) wants to merge 2 commits into
Draft
Osvaldo Ortega (osortega) wants to merge 2 commits into
Osvaldo Ortega (osortega) wants to merge 2 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>
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.

Draft and dependency
Depends on the proposed public contract in microsoft/agent-host-protocol#451 (synced from
5eadbe33f6048f748fe42a0a125b96e91414bfdc). Keep this draft pending protocol review and a host implementing that contract.Supersedes the closed #336294. This replacement starts from current
main; it does not carry the vendor-cloning adapter or arbitrary RPC dispatch API.Summary
SessionConfigSchema.repository, using host-chosen URL and revision property IDs instead of a vendor method or hardcoded configuration names.createSession; the host owns checkout preparation. Existing directory behavior remains when the descriptor is absent, including hosts without configuration discovery.Validation
npm run typecheck-clientpassed.npm run valid-layers-checkpassed.git diff --checkpassed.Manual / interoperability verification still needed
No full build, live sandbox, or released-client binary compatibility run was performed. Test results are unit/simulated contract evidence, not a production rollout guarantee.