* Cloud agent: Create/Open pull request toolbar actions for settled tasks
Adds chat-input toolbar actions for v2 (Task API) cloud agent sessions:
- "Create pull request" for a settled, PR-less task; the backend resolves the
repo from the task (html_url, falling back to a GitHub repo-by-id lookup) and
creates the PR, then re-applies the toolbar gates in place.
- "Open pull request" (icon-only) once the task has a PR, opening it in the
browser; resolves both task- and PR-keyed session resources.
Also: compare-based changed files for settled PR-less tasks, reactive gate
re-evaluation on task settle / PR creation, and resolver-path telemetry.
Core: icon-only rendering for the open-PR action in the session changes toolbar.
* Address review: fix create-PR response test shape, stale wording, telemetry name
- Test FakeTaskApiClient now returns the real AgentTaskCreatePullRequestResponse
shape ({ id, number, repository_id }) instead of the stale { pull_request }.
- Reword the no-reflect warning and create-handler doc that wrongly implied a
refresh (the handler updates the toolbar gates in place).
- Rename the resolver telemetry event back to copilotcloud.pullArtifactResolve.
- Drop the 'browser-open glyph' wording now that the open-PR icon is git-pull-request.
Fix chat.plugins.enabledPlugins setting description to be less enterprise-focused
Remove 'Enterprise-managed' prefix, add link to agent plugins docs, and
reference the marketplace setting for clarity. The setting controls plugin
enablement for all users, not just enterprise scenarios.
Fixes#321479
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds an enterprise policy to allow admins to control the Codex agent
provider registration, mirroring the existing Claude3PIntegration policy.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: validate copilotTelemetryURL in GitHub telemetry sender (fixes#321454)
The applicationinsights Sender throws TypeError: Invalid URL when the
copilotTelemetryURL from @vscode/copilot-api is a malformed URL string.
The new vscode-extension-telemetry reporter (introduced in #3331) passed
it to AppInsightsClientOptions.endpointUrl without validation, unlike the
old AzureInsightReporter which guards with URL.canParse(). Mirror that
guard so the default endpoint is kept when the URL is invalid.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: use ChatResponsePart action for task_complete summary
Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>
---------
Co-authored-by: vs-code-engineering[bot] <122617954+vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vijayupadya <41652029+vijayupadya@users.noreply.github.com>
Remove the 'preview' tag from chat.plugins.enabled and the
'experimental' tags from chat.plugins.enabledPlugins and
chat.plugins.extraMarketplaces as plugins are no longer in preview.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set DEBIAN_FRONTEND=noninteractive in copilot agent terminals to prevent
apt/dpkg TUI prompts (e.g. needrestart 'Which services should be
restarted?' dialogs) that the agent cannot drive.
Add system prompt guidance warning the model to never pipe interactive
commands through tail/head/grep/etc., which hides prompts from the
output monitor's input-needed detection.
Found via terminalbench2 eval analysis: these two issues caused
consistent failures in compile-compcert (pipe buffering hid opam [Y/n]
prompt) and nginx-request-logging (needrestart TUI prompt not detected,
agent wasted 5 minutes then gave up).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The agent feedback overlay widget is anchored to the right edge of the editor content area. When a line of code extends underneath the widget, the user could not scroll it out from under the widget because the editor cannot scroll past its longest line.
Implement IOverlayWidget.getMinContentWidthInPx() on the widget so the editor reserves enough horizontal scroll width (widest of the anchored line and its neighbours plus the widget width) to always let the content be scrolled clear of the widget. The value falls back to an estimated width until the DOM node is rendered and is cached once a real width and line measurement are available, with the cache invalidated when the anchor line changes.
Fixes#321270
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Sandeep Somavarapu <sasomava@microsoft.com>
* sessions: move active session to the view service (ISessionsService)
Make ISessionsService (the view facade) the sole owner and exposer of
the active session, mirroring VS Code's IEditorService.activeEditor
pattern where the view layer owns the active slot.
- Remove activeSession/setActiveSession/replaceActiveSession and the
active-session context-key bindings from ISessionsManagementService
(the model service).
- Expose activeSession plus the active-session context keys from
ISessionsService instead; SessionsNavigation now derives the active
session observable from the view service.
- Migrate all consumers from <management>.activeSession to
<view>.activeSession and adjust service injection accordingly.
- Update test mocks/fixtures and SESSIONS.md / LAYOUT.md docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: compare session URIs with isEqual in agentHostCustomizationService
Address code review feedback: use isEqual from vs/base/common/resources
instead of toString() equality for URI comparison.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: sync agent-host-protocol to b55919a (multi-chat)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: route turn access via defaultChat helpers
Adopt the multi-chat Agent Host Protocol: turns, active turn, steering,
queued messages and input requests moved off the session and onto a
per-chat channel. A single default-chat compatibility layer recombines
the session with its default chat so existing consumers keep working:
- Server (AgentHostStateManager) routes chat actions to the default chat
and exposes a merged ISessionWithDefaultChat view.
- Client (AgentHostSessionHandler) subscribes to both the session and its
default chat channel and merges them for reads.
- Widen action dispatch/emit signatures to SessionAction | ChatAction and
migrate turn/tool-call/input wire strings from session/* to chat/*.
- Update tests and mock connection to serve ChatState for default-chat
subscriptions and route chat actions accordingly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: adapt post-merge tests to multi-chat Chat* action names
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: repair chat retrieval and config regressions from multi-chat adoption
The multi-chat AHP adoption introduced two classes of regressions:
1. Chat retrieval/echo routing: chat actions now emit on the derived
default-chat channel, but several consumers were still keyed on the
session URI. Await both the session and default-chat subscriptions
before reading history, restore the chat channel on subscribe, forward
ChatActions, and normalize chat<->session URIs in dispatch/side-effects.
2. Session config loss: getSessionState() now returns a merged composite
copy (mergeSessionWithDefaultChat), and _ensureDefaultChat replaced the
live map entry with a clone. Callers mutating the returned object
(state.config = ...) stranded the mutation on a throwaway. Fix:
_ensureDefaultChat mutates in place to preserve createSession/
restoreSession return identity, and a new setSessionConfig() mutates the
live map object for the async restore path.
Tests migrated to setSessionConfig() where they previously seeded config by
mutating getSessionState() returns; duplicate-restore and client-echo tests
updated to reflect the two-channel (session + default-chat) model.
All agentHost node suites (409) and the browser contribution suite (148)
pass; typecheck and valid-layers-check are clean.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: sync agent-host-protocol to d7f592e (chat interactivity)
Regenerates the vendored protocol/ from agent-host-protocol @ d7f592e,
which adds the optional `interactivity?: "full" | "read-only" | "hidden"`
metadata to `ChatState`/`ChatSummary` and the `ChatInteractivity` type.
Mechanical sync only (scripts/sync-agent-host-protocol.ts); no hand edits.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: preserve chat interactivity across summary/state helpers
Carries the new optional `interactivity` field through the VS Code glue
converters so it round-trips between `ChatState` and `ChatSummary`
(`createChatState`, `chatSummaryFromState`) and re-exports the
`ChatInteractivity` type alongside the other chat types.
Absence still defaults to "full", so single-default-chat sessions are
unchanged; this just stops the field being dropped during denormalization.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: sync protocol to 83fae5a (ChatInteractivity const enum)
Re-sync the vendored agent-host-protocol from a685a3e to 83fae5a, which
refactors ChatInteractivity from a string-union type to a const enum.
Pure type-level change with identical runtime string values; glue code
only passes interactivity through, so no source changes required.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* address PR review feedback on multi-chat adoption
- sync protocol to b88a4a3: Snapshot.state union now includes ChatState,
dropping the IStateSnapshot widening shim (con1)
- handler: resolve the default chat URI from the live session state's
defaultChat field instead of assuming a URI structure, with the
deterministic fallback clearly marked as temporary migration (con2, con3)
- protocolServerHandler: reject createChat for non-default chats with a
ProtocolError instead of silently succeeding (ccr2)
- agentSubscription: make getPendingActions type-honest by widening the
pending-action type to SessionAction | ChatAction and renaming the
channel field, removing the unsafe cast (ccr3)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix turn telemetry test stranded config mutation
getSessionState returns a detached composite (session merged with its
default chat), so mutating its config stranded the change. Use the
stateManager.setSessionConfig API to write the authoritative session
state instead, matching what agentService does in production.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: route protocol integration tests through default chat channel
The multi-chat protocol adoption moved conversation contents (turns,
activeTurn, queued/steering messages, input requests) onto the session's
default chat channel, and renamed turn/tool-call/responsePart actions from
`session/*` to `chat/*`. The Protocol WebSocket integration tests still
subscribed only to the session channel and dispatched/awaited the old
`session/*` action types, causing notification timeouts and reads of
undefined turn arrays.
- Add `fetchSessionWithChat` helper that subscribes to both the session and
its default chat channel and returns the merged ISessionWithDefaultChat view
- Update turnExecution, sessionFeatures, sessionLifecycle, multiClient to read
turn/conversation state via the merged helper
- Rename stale `session/*` conversation actions to `chat/*` in clientTools,
toolApproval, turnExecution, and realSdkTestHelpers
- Subscribe secondary multi-client clients to the default chat channel
- Fix copilotRealSdk usage assertion to read turns from the default chat
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: assert chat/turnStarted in AgentHost smoke test
The multi-chat protocol adoption dispatches turns as `chat/turnStarted`
on the session's default chat channel instead of `session/turnStarted`.
Update the Agents Window smoke test to look for the new action type in
the AHP JSONL transcript.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: re-pin protocol to b3319ca (multi-chat merged to main)
The multi-chat sessions change landed on agent-host-protocol main as
b3319ca ("feat: multi-chat sessions (#213)"). The vendored copy was
previously synced from the PR branch (b88a4a3); the generated types are
byte-identical, so this only advances the .ahp-version pin to the merged
commit.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: migrate task_complete markdown to ChatResponsePart after multi-chat rename
Resolves a semantic merge conflict between #320931 (multi-chat rename:
SessionResponsePart -> ChatResponsePart) and #321422 (task_complete
markdown), which merged textually on main without conflict markers but
left three unresolved ActionType.SessionResponsePart references.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: improve tool set configuration flows and selection correctness
- add Configure Tools CodeLens support for .toolsets.jsonc files
- remove .toolsets.jsonc when deleting the last user tool set
- harden tool selection serialization for partial toolset deselection
- add regression coverage for toolset/member selection edge cases
* chat: address tool sets PR review comments
- getEnabledSelectionReferences skips a tool set when a member tool is explicitly unchecked, so partial deselections no longer re-enable hidden tools
- ConfigureToolSets falls back to the active chat widget's tool selection when invoked without an explicit selection (F1 / view title menu)
- CodeLens command handler returns the async updateTools promise so failures surface and completion is tracked
* chat: fix tsgo strict-mode compile errors in tool sets code
- toolSetsCodeLensProvider: narrow command args via index access so tsgo carries type-guard narrowing to updateTools
- languageModelToolsService.test: annotate Map<IToolData | IToolSet, boolean> so the mixed-key literal resolves an overload
* chat: satisfy tsgo strict type guard in tool sets code lens
isITextModel expects IEditorModel, not unknown; type the command arg as IEditorModel so the guard accepts it and narrows to ITextModel.
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* chore: sync agent-host-protocol to b55919a (multi-chat)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: route turn access via defaultChat helpers
Adopt the multi-chat Agent Host Protocol: turns, active turn, steering,
queued messages and input requests moved off the session and onto a
per-chat channel. A single default-chat compatibility layer recombines
the session with its default chat so existing consumers keep working:
- Server (AgentHostStateManager) routes chat actions to the default chat
and exposes a merged ISessionWithDefaultChat view.
- Client (AgentHostSessionHandler) subscribes to both the session and its
default chat channel and merges them for reads.
- Widen action dispatch/emit signatures to SessionAction | ChatAction and
migrate turn/tool-call/input wire strings from session/* to chat/*.
- Update tests and mock connection to serve ChatState for default-chat
subscriptions and route chat actions accordingly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: adapt post-merge tests to multi-chat Chat* action names
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: repair chat retrieval and config regressions from multi-chat adoption
The multi-chat AHP adoption introduced two classes of regressions:
1. Chat retrieval/echo routing: chat actions now emit on the derived
default-chat channel, but several consumers were still keyed on the
session URI. Await both the session and default-chat subscriptions
before reading history, restore the chat channel on subscribe, forward
ChatActions, and normalize chat<->session URIs in dispatch/side-effects.
2. Session config loss: getSessionState() now returns a merged composite
copy (mergeSessionWithDefaultChat), and _ensureDefaultChat replaced the
live map entry with a clone. Callers mutating the returned object
(state.config = ...) stranded the mutation on a throwaway. Fix:
_ensureDefaultChat mutates in place to preserve createSession/
restoreSession return identity, and a new setSessionConfig() mutates the
live map object for the async restore path.
Tests migrated to setSessionConfig() where they previously seeded config by
mutating getSessionState() returns; duplicate-restore and client-echo tests
updated to reflect the two-channel (session + default-chat) model.
All agentHost node suites (409) and the browser contribution suite (148)
pass; typecheck and valid-layers-check are clean.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: sync agent-host-protocol to d7f592e (chat interactivity)
Regenerates the vendored protocol/ from agent-host-protocol @ d7f592e,
which adds the optional `interactivity?: "full" | "read-only" | "hidden"`
metadata to `ChatState`/`ChatSummary` and the `ChatInteractivity` type.
Mechanical sync only (scripts/sync-agent-host-protocol.ts); no hand edits.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: preserve chat interactivity across summary/state helpers
Carries the new optional `interactivity` field through the VS Code glue
converters so it round-trips between `ChatState` and `ChatSummary`
(`createChatState`, `chatSummaryFromState`) and re-exports the
`ChatInteractivity` type alongside the other chat types.
Absence still defaults to "full", so single-default-chat sessions are
unchanged; this just stops the field being dropped during denormalization.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: sync protocol to 83fae5a (ChatInteractivity const enum)
Re-sync the vendored agent-host-protocol from a685a3e to 83fae5a, which
refactors ChatInteractivity from a string-union type to a const enum.
Pure type-level change with identical runtime string values; glue code
only passes interactivity through, so no source changes required.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* address PR review feedback on multi-chat adoption
- sync protocol to b88a4a3: Snapshot.state union now includes ChatState,
dropping the IStateSnapshot widening shim (con1)
- handler: resolve the default chat URI from the live session state's
defaultChat field instead of assuming a URI structure, with the
deterministic fallback clearly marked as temporary migration (con2, con3)
- protocolServerHandler: reject createChat for non-default chats with a
ProtocolError instead of silently succeeding (ccr2)
- agentSubscription: make getPendingActions type-honest by widening the
pending-action type to SessionAction | ChatAction and renaming the
channel field, removing the unsafe cast (ccr3)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix turn telemetry test stranded config mutation
getSessionState returns a detached composite (session merged with its
default chat), so mutating its config stranded the change. Use the
stateManager.setSessionConfig API to write the authoritative session
state instead, matching what agentService does in production.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: route protocol integration tests through default chat channel
The multi-chat protocol adoption moved conversation contents (turns,
activeTurn, queued/steering messages, input requests) onto the session's
default chat channel, and renamed turn/tool-call/responsePart actions from
`session/*` to `chat/*`. The Protocol WebSocket integration tests still
subscribed only to the session channel and dispatched/awaited the old
`session/*` action types, causing notification timeouts and reads of
undefined turn arrays.
- Add `fetchSessionWithChat` helper that subscribes to both the session and
its default chat channel and returns the merged ISessionWithDefaultChat view
- Update turnExecution, sessionFeatures, sessionLifecycle, multiClient to read
turn/conversation state via the merged helper
- Rename stale `session/*` conversation actions to `chat/*` in clientTools,
toolApproval, turnExecution, and realSdkTestHelpers
- Subscribe secondary multi-client clients to the default chat channel
- Fix copilotRealSdk usage assertion to read turns from the default chat
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: assert chat/turnStarted in AgentHost smoke test
The multi-chat protocol adoption dispatches turns as `chat/turnStarted`
on the session's default chat channel instead of `session/turnStarted`.
Update the Agents Window smoke test to look for the new action type in
the AHP JSONL transcript.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: re-pin protocol to b3319ca (multi-chat merged to main)
The multi-chat sessions change landed on agent-host-protocol main as
b3319ca ("feat: multi-chat sessions (#213)"). The vendored copy was
previously synced from the PR branch (b88a4a3); the generated types are
byte-identical, so this only advances the .ahp-version pin to the merged
commit.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: inline rename for chats in the chat composite bar
Support renaming a chat directly inside its tab in the chat composite
bar, mirroring the inline rename of the session title. Double-click a
tab (or use the context menu "Rename") to reveal a themed InputBox
pre-filled with the chat title; Enter commits via renameChat, Escape or
blur cancels.
The rename input lives in a stable, empty per-tab container that is
toggled via the tab's `editing` CSS class; the InputBox is created lazily
only while editing and disposed when done, so no DOM is inserted/removed
on demand and unused tabs carry no widget overhead.
Also adds a component fixture (chatCompositeBar.fixture.ts) covering the
two-tab, mixed-status, long-title and renaming states for screenshot
testing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: switch tabs via click, keep rename blur a pure cancel
Address PR review: the tab click handler bailed out while editing and the
input blur handler switched tabs via relatedTarget. Because blur clears
the editing state before the trailing click fires, this could switch
twice (extra openChat/flicker) and was order-sensitive.
Now blur only cancels the rename, and the tab click handler cancels any
in-progress edit before switching, so tab switching follows the normal
click path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: render task_complete as markdown
Render Copilot Autopilot task_complete summaries as root markdown response parts instead of regular tool calls so they do not appear nested under the previous collapsed tool/thinking block. Applies to both live Agent Host events and restored session history.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: complete replayed task_complete turns
Mark restored Copilot task_complete turns complete after converting their summaries to root markdown, matching the live idle-completion path.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move provider ordering into SessionsProvidersService.getProviders() so it
always returns providers stably sorted by ISessionsProvider.order (lower
first). Remove the now-redundant _getOrderedProviders() helper from
SessionsManagementService and route all callers (including
_resolveProviderForNewSession) through the ordered list, so new-session
provider resolution respects provider precedence.
Also make the "New Chat" command inherit the active session's providerId
and sessionType (in addition to its workspace folder) so a new session
defaults to the same kind the user is currently working in.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Harden the auth change event
* Fix
* fix comments
* address a few nits
* fix copilot token fire when transitioning to undefined
* More updates!
* More cleanup
* more fix
* More updates
* tests
When transferable streams are unsupported (Safari/WebKit), webview
resource chunks are sent via postMessage with a transfer list. The
chunk was wrapped as a view over its underlying ArrayBuffer and that
whole ArrayBuffer was transferred. In web/remote mode the chunk can be
a view aliasing a larger, shared buffer (e.g. from the IPC deserialize
pipeline), so transferring it detached every sibling view. WebKit
detaches synchronously, throwing "Underlying ArrayBuffer has been
detached from the view" and breaking webview resource loading.
Copy the chunk into a freshly-owned ArrayBuffer (sized to exactly the
chunk window) before transferring it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>