Repository navigation
chat: support named and prompted Agent Host forks - #341230
Merged
Don Jayamanne (DonJayamanne) merged 21 commits intoOct 18, 2026
Merged
Conversation
Carry optional fork titles through Agent Host transports and both VS Code session surfaces, advertise support explicitly, and preserve ordinary forks for older hosts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt the named-fork slash-command test to the new Agent Host connections service constructor dependency introduced upstream. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add prompt-bearing Agent Host forks, preserve source-turn context, generate context-aware titles, and expose completion templates with argument hints and recovery behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the upstream utility-model test adapter after rebasing prompted forks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Localize the named and prompted fork descriptions for #341229. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Named-title parsing, active-turn selection, attachment cleanup, and inherited agent-state handling have unresolved correctness defects.
5 open findings
What changed in this PR
Adds named and prompted Agent Host chat forks across editor and Agents windows.
Changes:
- Adds
/forkcompletion variants, argument hints, and accessibility help. - Extends Sessions and AHP fork contracts with titles and initial messages.
- Adds provider, admission, title-generation, recovery, and end-to-end coverage.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts |
Updates the fork mock signature. |
src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts |
Tests successful and failed slash-command completion. |
src/vs/workbench/contrib/chat/test/browser/widget/input/editor/chatInputEditorContrib.test.ts |
Covers /fork token deletion. |
src/vs/workbench/contrib/chat/test/browser/widget/input/editor/chatInputCommandArgumentHint.test.ts |
Tests local hints and prefix styling. |
src/vs/workbench/contrib/chat/test/browser/chatWidgetSlashCommand.test.ts |
Tests prompt-fork input cleanup and attachments. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts |
Covers Agent Host fork options and boundaries. |
src/vs/workbench/contrib/chat/test/browser/accessibility/chatAccessibilityHelp.test.ts |
Verifies fork accessibility documentation. |
src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.ts |
Adds completion variants and execution context. |
src/vs/workbench/contrib/chat/common/chatSessionsService.ts |
Defines initial-message and fork contracts. |
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts |
Reports successful silent command execution. |
src/vs/workbench/contrib/chat/common/chatService/chatService.ts |
Adds the slash-command completion callback. |
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts |
Produces capability-gated fork completions. |
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.ts |
Manages local hints and command styling. |
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts |
Preserves and conditionally clears fork drafts. |
src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts |
Implements named and prompted /fork. |
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts |
Forwards fork options to providers. |
src/vs/workbench/contrib/chat/browser/actions/chatForkActions.ts |
Adds fork options and failure recovery. |
src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.ts |
Documents the new fork workflows. |
src/vs/sessions/SESSIONS.md |
Documents the multi-chat fork contract. |
src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts |
Tests forwarding provider fork options. |
src/vs/sessions/services/sessions/common/sessionsProvider.ts |
Extends the provider fork API. |
src/vs/sessions/services/sessions/common/sessionsManagement.ts |
Extends the management fork API. |
src/vs/sessions/services/sessions/browser/sessionsManagementService.ts |
Routes fork options to providers. |
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts |
Tests titles, prompts, models, and agents. |
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostForkActions.test.ts |
Tests Agents-window fork action routing. |
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts |
Implements Agent Host provider fork options. |
src/vs/sessions/contrib/providers/agentHost/browser/agentHostForkActions.ts |
Routes and opens peer-chat forks. |
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md |
Documents private AHP capability handling. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Tests title and initial-message ingress. |
src/vs/platform/agentHost/test/node/mockAgent.ts |
Advertises new mock capabilities. |
src/vs/platform/agentHost/test/node/e2e/suites/multiChatSuite.ts |
Adds multi-chat conformance scenarios. |
src/vs/platform/agentHost/test/node/e2e/providers/copilotTestConfiguration.ts |
Enables Copilot capability coverage. |
src/vs/platform/agentHost/test/node/e2e/providers/codexTestConfiguration.ts |
Enables Codex capability coverage. |
src/vs/platform/agentHost/test/node/e2e/providers/claudeAgentHostE2E.integrationTest.ts |
Enables Claude capability coverage. |
src/vs/platform/agentHost/test/node/e2e/harness/agentHostE2ETestHarness.ts |
Extends provider capability configuration. |
src/vs/platform/agentHost/test/node/e2e/conformance/agentHostConformance.integrationTest.ts |
Enables reference-host coverage. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Verifies Copilot and mock descriptors. |
src/vs/platform/agentHost/test/node/codex/codexCreateChat.test.ts |
Verifies Codex capabilities. |
src/vs/platform/agentHost/test/node/claudeAgent.test.ts |
Verifies Claude capabilities. |
src/vs/platform/agentHost/test/node/agentHostTurnService.test.ts |
Tests initial-message admission rejection. |
src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts |
Tests prompt-aware fork naming. |
src/vs/platform/agentHost/test/node/agentHostE2EServerLease.test.ts |
Updates the lease test configuration. |
src/vs/platform/agentHost/test/electron-browser/localAgentHostService.test.ts |
Tests AHP versus management routing. |
src/vs/platform/agentHost/test/electron-browser/agentHostProtocolClient.test.ts |
Tests title and message serialization. |
src/vs/platform/agentHost/node/protocolServerHandler.ts |
Handles new createChat fields. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Advertises Copilot support. |
src/vs/platform/agentHost/node/codex/codexAgent.ts |
Advertises Codex support. |
src/vs/platform/agentHost/node/claude/claudeAgent.ts |
Advertises Claude support. |
src/vs/platform/agentHost/node/agentSideEffects.ts |
Forwards prompt context to title generation. |
src/vs/platform/agentHost/node/agentHostTurnStarter.ts |
Reports definite admission rejection. |
src/vs/platform/agentHost/node/agentHostTurnService.ts |
Adds client-originated turn startup. |
src/vs/platform/agentHost/node/agentHostSessionTitleController.ts |
Generates prompt-aware fork titles. |
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts |
Routes supported fields over AHP. |
src/vs/platform/agentHost/common/state/protocol/common/errors.ts |
Adds the initial-message rejection error. |
src/vs/platform/agentHost/common/state/protocol/channels-root/state.ts |
Adds fork capability flags. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/commands.ts |
Adds createChat title semantics. |
src/vs/platform/agentHost/common/state/AGENTS.md |
Documents the protocol backport. |
src/vs/platform/agentHost/common/agentService.ts |
Extends Agent Host creation contracts. |
src/vs/platform/agentHost/common/agent.ts |
Adds host-owned initial messages. |
src/vs/platform/agentHost/browser/agentHostProtocolClient.ts |
Serializes titles and initial messages. |
src/vs/platform/agentHost/AGENTS.md |
Updates Agent Host capability documentation. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve upstream recorded chat ownership and adapt fork tests to its service contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review feedback for #341230: resolve streaming fork boundaries, retain inherited agent selection, identify in-flight operations without serializing attachments, parse prefixed titles, and protect edited attachment drafts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Base:
|
Guard fork-only draft inspection before accessing the composer. Update title tests for normalized storage and explicit user title ownership, and correct test formatting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wait for pending normalized metadata and migration writes before dropping resident state, scoped to the released session. Preserve write error reporting and cover command and client renames across restoration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the existing fork capability and optional title field. Report initial-message failures in the target turn and persist rejected turns across reload. Remove special rejection draft recovery while keeping unknown-outcome inspection and no-resend behavior. Replicates microsoft/agent-host-protocol#526 review changes for #341230. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Don Jayamanne (DonJayamanne)
added a commit
to microsoft/agent-host-protocol
that referenced
this pull request
Oct 13, 2026
Keep title optional without new capabilities or naming mandates. Reuse normal turn errors for initial messages and regenerate the schemas and clients. Update compatibility fixtures and the TypeScript round-trip dispatcher. Addresses review on #526; companion implementation microsoft/vscode#341230. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Revert 29e29e2 (session metadata drain before idle eviction). The race it fixes is reached through the pre-existing rename paths and is independent of forking; it is tracked separately. Also remove the unused startClientTurnMessage overload, collapse the single-field ICapturedForkInitialMessage wrapper, drop a stray blank line, and right-size the fork accessibility help to match the surrounding entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…xploration-vscode * origin/main: (40 commits) MSRC fixes (#341342) chat: render input attachments for the input model's session (#341350) chat: center subagent tool activity hooks (#341258) Manage Copilot plugin marketplaces through Agent Host (#341301) fix: linux setuid sandbox helper permissions (#341292) agentHost: resolve #chat chips on the host of the chat that shows them (#341332) [Perf] agentHost: limit archived sessions over Mission Control (#341327) Remember expanded state for "Other Models" in model picker (#341335) Offer Stop for copilot detached background shells (#341310) agentHost: allow inherited peer chats to move workspaces (#341317) [Perf] agentHost: reduce Mission Control relay overhead (#341223) Fix Customizations modal spacing (#341144) Fix dependency cycle in QuickInputService and EditorResolverService (#341321) Fix Explorer refresh on restoring deleted workspace root folder (#341323) chat: Share and rate-limit core utility model requests (#340100) agentHost: open #chat chips on the connection that owns the chat (#341313) Fix flaky StorageMainService tests by awaiting storage warm-up (#341305) agentHost: record the default chat role instead of reading the default chat URI shape (#341293) welcome: preserve tab icon color with Modern Icons Fix flaky test in diskFileSystemProvider.test.ts (#341304) ... # Conflicts: # src/vs/platform/agentHost/node/agentService.ts # src/vs/platform/agentHost/node/protocolServerHandler.ts # src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts # src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts
The unknown-outcome notification hid the underlying error, so definite pre-creation failures (for example "Wait for workspace setup to finish") were reported only as an unknown outcome. Include the cause in the message. Inspect Target waited for a chat that may never appear and then returned silently. Report that failure instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rejected turns were made durable for every chat so a rejected fork prompt would survive a reload. Ordinary rejections leave the message in the client's composer, so persisting them kept records nothing needs. Follow the resumable precedent on the error variant: the rejected variant now carries recoverable, producers default to recoverable, and only the create-chat initial message opts out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restores 29e29e2. CI proves the drain is load-bearing for this branch: runs 508c2b9 and 30baf6d (no drain) failed `peer chat catalog and transcript survive a host restart`, 29e29e2 (drain) was fully green, and 4aeb97e (drain reverted) failed again on Linux and Windows. The same test passes on contemporaneous unrelated pull requests. The underlying race is pre-existing and remains tracked separately, but this branch triggers it reliably, so the ordering fix stays here. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep legacy chat restoration from reading an older catalog while an accepted rename is still being synchronized. Drain the session's catalog and passive metadata writes before releasing it, and scope their rejecting peer-write barriers to that session. Cover compatibility-storage renames and scoped write errors. Keep the existing restart assertion unchanged and synchronize the ordered-catalog test on its actual summary notification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt named and prompted forks to upstream opaque chat identities while preserving default-chat initial-message handling and session-scoped catalog drains. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Don Jayamanne (DonJayamanne)
marked this pull request as ready for review
October 14, 2026 12:36
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Sandeep Somavarapu (@sandy081)Matched files:
Ladislau Szomoru (@lszomoru)Matched files:
|
Giuseppe Cianci (Giuspepe)
previously approved these changes
Oct 14, 2026
Preserve named and prompted forks across upstream credential, configuration, storage, session-move, and hint APIs. Keep duplicate-target checks ahead of configuration seeding and adapt lifecycle regression gates to the current catalog write path without relaxing title expectations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve worktree-sharing rollback and default multi-root capability changes alongside the fork feature and its session-scoped catalog barriers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Oct 17, 2026
Don Jayamanne (DonJayamanne)
enabled auto-merge (squash)
October 17, 2026 00:05
Update the complete descriptor expectation retained by the fork feature to match main's intentional multi-root default. Keep the strict capability assertion and runtime behavior unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Alexandru Dima (alexdima)
previously approved these changes
Oct 17, 2026
Keep the named/prompted fork routing regression alongside upstream sandbox-certificate management coverage. Preserve both local management and AHP routing behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Alexandru Dima (alexdima)
approved these changes
Oct 18, 2026
Don Jayamanne (DonJayamanne)
deleted the
copilot/fork-prompt-exploration-vscode
branch
October 18, 2026 23:09
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 #341229
Summary
Add named and prompted forks to Agent Host chats in the editor and Agents windows:
/forkkeeps its immediate fork behavior./fork <title>creates a fork with the specified initial title./fork prompt <prompt>creates a fork and sends the prompt with attached context. VS Code's naming strategy can use the source title and new prompt.The three completion entries have distinct localized descriptions. The title/prompt templates insert without submitting, show argument hints, and highlight the complete command prefix without adding command-token editing side effects.
Following review of the AHP companion PR, all fork variants use the existing fork capability. Optional titles and the existing
initialMessageneed no additional capability. Older hosts may ignore the new title field.Initial-message failures appear as ordinary errors in the created chat, rather than a special creation RPC error. Admission-rejected initial messages survive reload; ordinary rejected turns retain their existing persistence behavior. Unknown transport/navigation outcomes show the underlying error and offer target inspection without automatically resending. Source-turn selection, model/agent inheritance, attachment handling, and source-owned draft cleanup remain intact.
The title-restoration repair drains the owning session's pending metadata and catalog writes before idle release. A controlled compatibility-storage regression reproduced a saved rename being replaced by the older cached title during reopening. The repair preserves title precedence and error propagation, scopes both active and passive catalog waits to the owning session, and leaves the existing restart E2E expectations unchanged.
How to test
In both window types, open an Agent Host conversation with at least one completed turn:
/forkand verify it forks immediately./fork <title>, enter a title, and submit. Verify the fork starts with that title./fork prompt <prompt>. Verify/fork promptis command-colored and the argument hint is separate. Enter a prompt, attach context, and submit; verify one new request in the fork with inherited history.Validation
Local checks after integrating main at
76e9dff43b2:npm run install-fast— passed, refreshing the SDK/runtime dependencies changed by main.npm run build-fast -- --client-only— passed.npm run typecheck-client— passed../scripts/test-integration.sh \ --run src/vs/platform/agentHost/test/node/e2e/providers/claudeAgentHostE2E.integrationTest.ts \ --run src/vs/platform/agentHost/test/node/e2e/providers/copilotAgentHostE2E.integrationTest.ts \ --run src/vs/platform/agentHost/test/node/e2e/providers/codexAgentHostE2E.integrationTest.ts \ --grep 'peer chat catalog and transcript survive a host restart'./scripts/test-integration.sh --reporter dot \ --run src/vs/platform/agentHost/test/node/e2e/conformance/agentHostConformance.integrationTest.ts \ --run src/vs/platform/agentHost/test/node/e2e/providers/copilotAgentHostE2E.integrationTest.ts \ --run src/vs/platform/agentHost/test/node/e2e/providers/codexAgentHostE2E.integrationTest.ts \ --run src/vs/platform/agentHost/test/node/e2e/providers/claudeAgentHostE2E.integrationTest.ts \ --grep 'titled peer|fork with an initial|fork.*initial|multiple chat capability'Draft notes