Skip to content

sessions: add browser links for Agent Host sessions - #334961

Open
Sandeep Somavarapu (sandy081) wants to merge 5 commits into
mainfrom
agents/implement-this
Open

sessions: add browser links for Agent Host sessions#334961
Sandeep Somavarapu (sandy081) wants to merge 5 commits into
mainfrom
agents/implement-this

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Sep 7, 2026

Copy link
Copy Markdown
Member

Fixes #334963

Summary

  • add product-protocol links that open Agent Host sessions and chats in the Agents window
  • route external links through the dedicated Agents window IPC handoff and resolve provider-scoped backend session identities
  • add Copy Link context-menu actions for Agent Host sessions and chats

Validation

  • npm run transpile-client
  • npm run typecheck-client
  • focused Agent Host link, opener, context-menu, and chat-tab unit tests
  • import layer validation and pre-commit hygiene
  • end-to-end verification by opening a code-oss://agents/agent-host-session/... URL in an isolated Agents window

Route product protocol links through the dedicated Agents window handoff so provider-scoped sessions and chats are revealed reliably. Add Copy Link actions to Agent Host session and chat context menus.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 7, 2026 18:14
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

Robo (@deepak1556)

Matched files:

  • src/vs/code/electron-main/app.ts

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/sessions/browser/parts/chatCompositeBar.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Multiple moderate issues affect link identity integrity, cold-start routing, and disconnected remote sessions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 4 Medium severity · 1 Low severity

New issues introduced by this change (5)
Severity Finding
Medium severity src/​vs/​code/​electron-main/​app.ts — On cold startup this URL is still queued in ElectronURLListener, which keeps the same…
Medium severity src/​vs/​platform/​agentHost/​common/​openSessionLink.ts — Serializing with skipEncoding after parsing the internal link corrupts opaque IDs containing…
Medium severity src/​vs/​sessions/​contrib/​chat/​electron-browser/​chat.contribution.ts — This wait cannot recover a lazily seeded remote Agent Host session after restart: matching depends…
Medium severity src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​agentHostSessionBranchActions.tsresolveSessionResource requires a live remote connection, but remote providers intentionally…
Low severity src/​vs/​sessions/​contrib/​chat/​browser/​sessionsChatAccessibilityHelp.ts — This help text says every nested chat offers Copy Link, but the action is contributed only for…
What changed in this PR

Adds product-protocol links for opening Agent Host sessions and chats in the Agents window.

Changes:

  • Adds external link building, parsing, and window routing.
  • Adds Copy Link actions for Agent Host sessions and chats.
  • Extends tests and accessibility guidance.
File Reviewed change Finding
src/​vs/​sessions/​contrib/​sessions/​test/​browser/​sessionsListContextMenu.test.ts Updates context-menu tests.
src/​vs/​sessions/​contrib/​sessions/​browser/​views/​sessionsList.ts Scopes chat menus by provider.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostSessionBranchActions.test.ts Tests generated links and actions.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​agentHostSessionBranchActions.ts Adds Agent Host Copy Link actions. Moderate: Lazily seeded remote sessions require a live connection, causing Copy Link to fail.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​openSessionLinkOpener.test.ts Tests backend identity resolution.
src/​vs/​sessions/​contrib/​chat/​electron-browser/​chat.contribution.ts Resolves and opens linked sessions. Moderate: Links to disconnected, lazily seeded remote sessions time out after restart.
src/​vs/​sessions/​contrib/​chat/​browser/​sessionsChatAccessibilityHelp.ts Documents Copy Link actions. Nit: Help incorrectly implies Copy Link is available for all providers.
src/​vs/​sessions/​contrib/​chat/​browser/​openSessionLinkOpener.contribution.ts Resolves provider-scoped session identities.
src/​vs/​sessions/​common/​sessionCommands.ts Defines Copy Link command IDs.
src/​vs/​sessions/​browser/​parts/​chatCompositeBar.ts Adds chat-tab Copy Link actions.
src/​vs/​platform/​window/​common/​window.ts Adds link-based window telemetry.
src/​vs/​platform/​agentHost/​test/​common/​openSessionLink.test.ts Tests external link handling.
src/​vs/​platform/​agentHost/​common/​openSessionLink.ts Builds and parses external links. Moderate: skipEncoding corrupts opaque IDs containing percent-escape text.
src/​vs/​code/​electron-main/​app.ts Routes protocol links to Agents windows. Moderate: Cold startup can open duplicate Agents windows because the URL remains queued.
src/​vs/​base/​common/​network.ts Defines the Agents URL authority.
Suppressed comments (2)

src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionBranchActions.ts:52

  • These provider-only menu conditions also expose Copy Link in the header of an uncreated Agent Host draft. The draft resource is only client-side, so the generated URL cannot be resolved in another window or process. Gate both session menu entries on created/committed state and defensively reject draft contexts in run.
				when: ContextKeyExpr.regex(SessionProviderIdContext.key, ANY_AGENT_HOST_PROVIDER_RE),
			}, {
				id: Menus.SessionHeaderContext,
				group: '2_edit',
				order: 2,
				when: ContextKeyExpr.regex(SessionProviderIdContext.key, ANY_AGENT_HOST_PROVIDER_RE),

src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionBranchActions.ts:75

  • The nested-chat context already provides sessionChatItem.isUntitled, but this new action does not exclude it. As a result, an untitled Agent Host chat gets Copy Link even though its client-side fragment is not yet a durable backend chat ID, producing a link that cannot be reopened. Add the same untitled negation used by the rename action.
				id: Menus.SessionChatItemContext,
				group: '2_copy',
				order: 1,
				when: ContextKeyExpr.regex(SessionProviderIdContext.key, ANY_AGENT_HOST_PROVIDER_RE),

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/code/electron-main/app.ts Outdated
Comment thread src/vs/platform/agentHost/common/openSessionLink.ts
Comment thread src/vs/sessions/contrib/chat/electron-browser/chat.contribution.ts
Comment thread src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.ts Outdated
Show an error after the Agents window finishes waiting for a session targeted by a browser link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show the browser-facing product URL so users can identify the session link that failed to resolve.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve opaque IDs, handle cold-start links once, and resolve remote session identity without requiring a live connection so seeded sessions can connect on demand.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use a /chat/<id> path segment for browser-facing chat links while preserving internal session-link compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Agents Window: Open Agent Host sessions and chats from browser links

3 participants