Commit Graph

160413 Commits

Author SHA1 Message Date
Dmitriy Vasyura
ed577eeefb Handle opened and unsaved documents as attachments for Agent Host/Copilot CLI (#321591) 2026-07-02 02:40:03 +00:00
Sandeep Somavarapu
9d557c6230 agentHost: chat-address the operational agent methods (collapse default/peer branches) (#323967)
* Refactor agent chat operations to resolve chats uniformly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Refactor chat ops to use concrete chat URIs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: tolerate a session URI at the chat-context chokepoint (fix CI)

The chat-addressing refactor removed the agents' tolerance for addressing the
default chat by its session URI (the AHP convention: default chat URI == session
URI). This broke integration tests that address the default chat by the session
URI (Malformed AHP chat URI) and restore via the mock agent (0 restored turns).

- Claude/Copilot `_getChatContext`: accept either a chat channel URI or a bare
  session URI, normalizing to the default-chat URI in the single resolution
  chokepoint (not re-derived per operational method). Codex already tolerant.
- MockAgent.getSessionMessages: normalize a default-chat channel URI back to the
  session URI, mirroring the real agents.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: remove the dead onDidEndChat membership channel

onDidEndChat was declared by Claude and Copilot but never fired: a completed
subagent chat stays live and is removed only on session teardown (via a direct
removeChat), so subagent_completed intentionally has no end event. Remove the
unused channel end-to-end — the agents' emitters, the optional
IAgent.onDidEndChat member, the orchestrator subscription + _onChatEnded handler,
and the synthetic test. onDidSpawnChat (which is fired) remains as a spawn-only
membership channel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: rename IResolvedAgentChat.session to chatSession

Address CCR feedback: `session` overwhelmingly means the owning session URI in
this codebase, so `IResolvedAgentChat.session` (the resolved chat session
instance) was easy to misread. Rename to `chatSession` and update the two call
sites in claudeAgent.ts / copilotAgent.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-02 01:49:08 +00:00
Sandeep Somavarapu
e63efae792 sessions: quick chats (workspace-less sessions) in the Agents window (#323972)
* sessions: quick chats — workspace-less single-chat sessions

Adds quick chats to the Agents window: lightweight chats not scoped to a
workspace, backed by an agent-host session. The host infers workspace-less
from an absent workingDirectory (forks excluded) and assigns a stable scratch
dir; the workspaceless tag rides the generic _meta bag. Quick chats are
single-chat, use the normal session presentation (Done hidden), render in an
always-visible in-list "Chats" section, and persist across reloads.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: New from a quick chat opens another quick chat (Round 23)

The primary "New" action gated quick-chat routing on `isCreated &&
isQuickChat`, but a quick-chat draft is Untitled (isCreated=false), so it
fell through to the workspace composer seeded with a throwaway scratch dir
(no session-type picker, "No models available").

Route on `isQuickChat` alone so a quick chat — draft or committed — opens
another quick chat mirroring its harness. Extract the routing into a pure,
side-effect-free `openNewChatOrQuickChat` helper so it is unit-testable
(chat.contribution.ts is not test-importable). Supersedes Round 14(2) and
updates Round 22(3); the Round 14(2) discard branch and Round 17 picker
re-parent are kept as internal defense.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: quick-chat list & layout polish (Round 22 items 1-2)

- Suppress the redundant per-row chat icon when a quick chat is rendered
  under the always-visible "Chats" section (the section header already
  carries a chat icon); keep it in Pinned/custom/date groups where the
  chat identity is useful.
- Disable the "Toggle Side Panel" command for quick chats via
  precondition IsQuickChatSessionContext.negate(), since a quick chat has
  no side pane (the empty aux bar is hidden and the chat is full-width).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: persist empty peer-chat catalog sentinel to avoid re-running legacy migration

When a session has no legacy peer chats, write an empty catalog so
_readPersistedPeerChatCatalog returns [] on subsequent restores and
_migrateLegacyPeerChats never re-runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Cmd+N always creates a new session; New Quick Chat gets Cmd+K Cmd+N (Round 24)

Per user feedback, Cmd+N must always open a NEW SESSION — never a quick
chat. Drop the context-aware quick-chat routing from
NewChatInSessionsWindowAction (rename its title "New Chat" -> "New Session",
keep the id) so it unconditionally calls openNewSession from the active
session; the helper is renamed openNewChatOrQuickChat -> openNewSessionFromActive.

Quick chats are created only via the Chats-section "+" (NewQuickChatAction),
which now has a default Cmd+K Cmd+N chord. The peer-chat "+" (Cmd+T) is
unaffected. Supersedes the Round 22(3)/23 mirror routing; the Round 14(2)
discard branch and Round 17 picker re-parent are untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Cmd+N never inherits a quick chat's folder into the workspace composer (Round 25)

New from a quick chat must always land on the clean New Session composer with
a visible session-type picker. Gate openNewSessionFromActive's folder
inheritance on isQuickChat so a quick chat never carries a (possibly leaked
scratch) workspace URI into openNewSession.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: re-seed workspace draft when composer swaps out of quick-chat mode (Round 25b)

Cmd+N from a quick chat reuses the new-session composer and only
_activate(undefined), leaving it session-less. The session-type picker hides
itself when it has no folder types (no active session), so no picker showed.
Re-run the constructor's workspace-draft seed from an autorun when the composer
transitions out of quick-chat mode with no active session, matching a freshly
opened new-session composer (folder + visible picker).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: quick-chat untitled title falls back to "New Chat" via shared helper (Round 26)

An untitled quick chat's titlebar showed "New Session" because the empty-title
fallback was hardcoded and not quick-chat aware. Add getUntitledSessionTitle(isQuickChat)
to the common layer and route all 5 fallback sites (titlebar, session header x2,
list hover, sessions picker) through it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: track isQuickChat in titlebar re-render autorun (Round 27)

The SessionsTitleBarWidget re-render autorun read the active session's
title and workspace but not isQuickChat, which _render() consumes for the
untitled title fallback. Track it as a reactive dependency for
forward-safety and consistency with other reactive render sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: move workspace-less marker ownership to the AH service

Each agent used to persist and re-emit its own workspace-less (quick chat)
marker (copilot.workspaceless / claude.workspaceless) in the shared session
database, and agents that persist nothing (Codex) lost the marker on restart.

Make the AH service the single owner: AgentService persists a single
agentHost.workspaceless key at create/materialize (from the value it already
infers in _buildInitialSummary) and overlays _meta.workspaceless onto every
agent's summary in listSessions. Agents no longer write or namespace the
marker; Copilot reads the shared key for its resume system prompt, and the
now-dead workspace-less plumbing is removed from the Claude session. This
fixes restored quick chats for every agent (including Codex) with no
per-agent code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions/agentHost: address review feedback (naming + inline)

- Rename the workspace-less launch-plan flag from isQuickChat to
  workspaceless in CopilotSessionLaunchPlan and IAgentHostPromptContext (and
  the disposeSession local) so the flag matches the workspaceless marker it
  flows from throughout the AH layer. Feature-descriptive names
  (COPILOT_AGENT_HOST_QUICK_CHAT_INSTRUCTIONS, _quickChatScratchDir) are kept.
- Inline openNewSessionFromActive back into NewChatInSessionsWindowAction.run
  and remove the single-caller seam module + its test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: make the AH service the sole owner of the workspaceless marker

Following the earlier ownership move, the agents still read + re-emitted
_meta.workspaceless in their metadata projections, which was redundant on the
listSessions path (AgentService overlays it centrally) and only load-bearing
on the single-session restore path.

Centralize the restore overlay in AgentService.restoreSession (reads
agentHost.workspaceless in its existing batch metadata read and merges it into
the restored summary _meta), then drop the per-agent re-emit: remove it from
the Claude metadata store entirely (Claude has no runtime need) and from the
Copilot listSessions/getSessionMetadata projections. Copilot keeps reading the
AH key for its resume system prompt and scratch-dir cleanup. Codex is now
covered centrally with no Codex code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: inline openQuickChatAndFocus into NewQuickChatAction

Single-caller helper folded into the action's run().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: make ISessionsProvider.createQuickChat mandatory

Replace the optional createQuickChat with a mandatory method that throws when
the provider does not support quick chats; callers now gate solely on the
supportsQuickChats capability instead of probing for the method. Workspace-bound
providers (Copilot chat, local chat) get an explicit throwing implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: use "workspace-less chat" terminology instead of "quick chat"

Rename the agent-host-internal quick-chat identifiers, prompt tags, and prose to
workspace-less: COPILOT_AGENT_HOST_QUICK_CHAT_INSTRUCTIONS ->
COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS, the <quick_chat> system-message
tag -> <workspaceless_chat>, and the scratch-dir helpers
(_quickChatScratchDir/_ensure*/_cleanup*/_withQuickChatScratch). The workbench
UI term "Quick Chat" is kept only where the agent host documents that mapping.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: address Copilot Code Review feedback on quick chats

- sessionsList: select the row chat icon from isQuickChatSession(), not from
  workspace === undefined, so a workspace session with a transiently-undefined
  workspace no longer briefly shows the chat icon.
- sessionContextKeys: correct the isQuickChat comment to reflect that the key
  is sourced from the isQuickChat tag, never inferred from workspace absence.
- Agents window accessibility help: document the New Quick Chat command
  (Cmd/Ctrl+K Cmd/Ctrl+N) and the Chats section plus button, and note that the
  workspace picker does not apply and Toggle Side Panel is disabled for quick chats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-02 00:38:15 +00:00
Connor Peet
17c6cd4836 Agent-host MCP authentication + accurate/persisted MCP auth state (#323968)
* wip on mcp auth through AH

* Preserve live MCP server state across customization re-syncs

The Agents window showed a connected GitHub MCP server flipping back to
'Starting' when navigating away from and back to a session. A client
re-subscribe re-published the session's customizations, and the
SessionCustomizationsChanged full-replace reset each MCP entry's state to
the 'Starting' default baked into makeMcpServerCustomization.

- Skip no-op customization re-syncs in SessionPluginController.sync so an
  identical re-publish (e.g. navigating back) does no work.
- SessionPluginController now overlays live MCP runtime state/channel onto
  every published customization via _projectForPublish, so a genuine
  single-customization change no longer resets otherwise-unchanged MCP
  servers. The overlay is driven by an ISettableObservable kept up to date
  by the session from McpCustomizationController.
- McpCustomizationController._live is now an observable and exposes
  runtimeStates as a derived; mutations are batched in transactions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Persist agent-host MCP auth and improve auth-required prompts

- Key remembered MCP auth on a stable id (session authority + server name +
  resource URL) instead of the unstable customization id, so grants survive
  reloads and don't require re-auth.
- Record agent-host metadata (authority + host label) on allowed MCP servers
  and surface agent-host servers in their own section of the Manage Trusted
  MCP Servers picker instead of filtering them out.
- Make the auth-required chat prompt reactive: servers is now an observable so
  servers whose auth requirement surfaces later join the existing prompt, and
  the part marks itself used once hidden so later requirements re-prompt.
- Show an 'Authenticating <server>...' progress state while each server auths.
- Drop the never-serialized mcpAuthenticationRequired part from the serialized
  response-part unions.
- Add unit tests for the stable-id helper, agentHost metadata persistence, and
  query-service exposure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address CI failure and Copilot review on MCP auth prompt

- Don't emit an empty mcpAuthenticationRequired progress part (was adding a
  stray part and breaking AgentHostChatContribution tool-progress tests).
- Guard the async auth filter with a run id so out-of-order completions can't
  overwrite a newer server list.
- Group agent-host servers in the Manage Trusted MCP Servers picker by stable
  authority (sorted by label) instead of label, which could collide.
- Scope the authenticate link to the #authenticate target and give it button
  semantics (role=button, cleared href).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-02 00:26:28 +00:00
Connor Peet
fc47281226 Merge pull request #323953 from microsoft/conno/log-client-tool-completion
Add client tool completion routing logs
2026-07-01 16:58:08 -07:00
Justin Chen
f170fd1f23 GA vision in vs code (#323965)
* GA vision in vs code

* address settings changes
2026-07-01 23:49:35 +00:00
Sandeep Somavarapu
8f1b02ba77 sessions: support read-only chats and surface subagents as read-only tabs (#323960)
Adds ChatInteractivity (Full/ReadOnly/Hidden) to IChat and hides the composer
for non-interactive chats (gated via chatIsReadonly context key). Surfaces agent
host subagent (tool-origin) chats as read-only peer tabs with a lock icon,
persisted across restart. Adds an inline "Open Subagent" pill in the transcript
and a "Subagents" dropdown above the chat input to reveal them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 23:48:37 +00:00
Sandeep Somavarapu
b7b8a8049d agentHost: resolve per-chat effective working directory in session projection (#323950)
* agentHost: remove Claude dead legacy migration + drop redundant session param

PART 1: remove the unreachable claude.chats legacy peer-chat migration
(listLegacyChats, _readPersistedChats, _META_CHATS and the two dead
fallback call sites). Copilot's copilot.chats migration and the
orchestrator's generic migration are unchanged.

PART 2A: drop the redundant session parameter from IAgentChats.createChat
and fork. Each agent derives the parent session from the chat URI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: demote default chat to a uniform chat-map entry

Restructure the shared AgentSessionEntry so a session's default (main)
chat lives in the SAME per-session chat map as its peers, keyed by its
default-chat URI. Send/abort/model/agent/history now resolve any chat
via one uniform getChat lookup with no default-vs-peer storage split.

- agentPeerChats.ts: single _chats map + _defaultChatKey; getChat is the
  uniform lookup; defaultChat/setDefaultChat/clearDefaultChat replace the
  separate default-session slot; peer accessors read the same map.
- Claude/Copilot seed the default chat into the map (setDefaultChat) and
  read it via defaultChat; _findChat is a single uniform lookup.
- Two lifecycle guards kept at the session boundary: createSession seeds
  the default entry; disposeChat/createChat refuse the default chat.
- Codex (single-chat) unchanged; still resolves through the session URI.

No protocol/state changes; behavior identical (Agent* suites green).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: resolve per-chat effective working directory in session projection

Generalize the mergeSessionWithDefaultChat projection so a chat's resolved
session-context view (working directory, active clients, config,
customizations/MCP scope, …) applies to ALL chats, not just the default one.

The projection already spreads the full SessionState onto every chat, but it
ignored ChatState.workingDirectory — a per-chat override the protocol allows so
a subordinate/peer chat can run in its own git worktree. Operational consumers
(changeset/commit/discard/git/PR/sync services + agentService) read the effective
cwd via getSessionState(...)?.workingDirectory, so a chat with its own worktree
incorrectly reported the session default. Layer chat.workingDirectory over the
session default in the projection so no code path has to walk back to the session.

Pure orchestrator-side projection: no wire-protocol, IAgent, or persisted-shape
change. Docs generalized from "default chat" to per-chat effective context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: route MockAgent createChat/fork through the resolved chat URI

Address CCR feedback: createChat/fork resolved the session via
_resolveChatTarget but passed the original chat argument, so a default-chat
call (session URI) would use the session URI instead of the resolved
default-chat channel URI. Destructure and pass the resolved { session, chat }
to match the other chat-addressed methods in the mock.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 22:47:27 +00:00
dileepyavan
c63b0bab6b Add Responses API cache control markers (#321850)
* Add Responses API cache control markers

* Refactoring code

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Gate Responses API cache breakpoints by model support

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 22:30:36 +00:00
Anthony Kim
d892b5773d Agent Host: Use SDK shell exit metadata for command decorations (#323922)
* use sdk shell_exit for command deocrations

* address copilot feedback

* comment
2026-07-01 15:18:00 -07:00
Paul
90b81ef265 Fix issues with chat perf pipeline (#323917) 2026-07-01 22:10:25 +00:00
Osvaldo Ortega
93e8c6cef9 Task API auth fix (#323951) 2026-07-01 22:09:32 +00:00
Connor Peet
df591a6ac2 Add client tool completion routing logs
Log the server-side forwarding path for client tool completions so reports can distinguish missing agents, missing peer chats, and subagent chat routing issues.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 14:56:52 -07:00
Ladislau Szomoru
34e2a17713 AgentHost - fix opening files when using checkpoint refs (#323932) 2026-07-01 21:50:39 +00:00
Osvaldo Ortega
d70651f223 Agents mobile: UX improvements to open workspace action (#322812)
* sessions: add explicit "Open this folder" action to the mobile workspace picker

Tapping a folder in the mobile workspace picker drills into that folder, which re-renders the search results and removes the visible checked state for the selected folder. That made it unclear that Done would select the browsed folder.

Add a confirm-close sentinel to the reusable mobile picker sheet so stay-open pickers can explicitly confirm a row. Use it from the workspace picker to prepend an "Open this folder" row for the currently browsed folder, while preserving child-folder drill-down and Done confirmation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: redesign mobile workspace picker "Select folder" as a single pinned action

Replace the synthetic checked "Open {folder}" row (which produced two
checkmarks and a Done/Open redundancy) with one tinted-accent, pinned
"Select {folder}" primary action above the folder list. Folder rows now
carry a chevron to signal drill-down, recents show only at the root, and
the header button is a plain Cancel.

Adds reusable primitives to the mobile picker sheet:
- `IMobilePickerSheetItem.navigates` renders a trailing chevron and is
  excluded from the radio-toggle.
- a pinned primary action driven declaratively by the search source via
  `IMobilePickerSheetSearchSource.getPrimaryAction(query)`.
- `doneLabel` to override the dismiss button label.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Review comments

---------

Co-authored-by: osortega <osortega@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 14:28:08 -07:00
Don Jayamanne
acf39e86ff feat: enhance chat context usage details with reactive rendering and equality checks (#323838)
* feat: enhance chat context usage details with reactive rendering and equality checks

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* feat: implement reactive rendering for chat context usage data updates

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 21:23:56 +00:00
dependabot[bot]
7e7f9505b9 build(deps): bump tmp from 0.2.6 to 0.2.7 in /test/automation (#323938)
Bumps [tmp](https://github.com/raszi/node-tmp) from 0.2.6 to 0.2.7.
- [Changelog](https://github.com/raszi/node-tmp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/raszi/node-tmp/compare/v0.2.6...v0.2.7)

---
updated-dependencies:
- dependency-name: tmp
  dependency-version: 0.2.7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-01 21:13:46 +00:00
Josh Spicer
5a270e6dbd policy: resolve managed settings per-key across delivery channels (#323780)
* policy: resolve managed settings per-key across delivery channels

Managed settings previously used a single authoritative source: the first
non-empty delivery channel (native MDM > server > file) won wholesale and the
others were ignored entirely. Switch to per-key precedence: the same order is
honored, but resolved key-by-key. A key locked by a higher-precedence channel
still cannot be overwritten, while keys a higher channel leaves unset are now
filled in by a lower channel.

Centralize the resolution in a new pickManagedSettings() (replacing
selectManagedSettings) that returns the merged bag, per-key provenance, and the
active sources, so policy evaluation and the Policy Diagnostics report share one
implementation. Build the merged bag with Object.fromEntries so an untrusted
__proto__ key cannot corrupt its prototype chain.

Rework the Policy Diagnostics report to show every contributing source, a per-key
Resolution table (effective value, winning source, and struck-through overrides),
and per-key policy attribution.

Add unit coverage for the per-key merge (provenance, fill-down, falsy values,
ordering, prototype-pollution guard) plus an end-to-end test proving two keys can
win from two different channels and both reach policy evaluation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* policy: iterate managed-settings bags with Object.keys over own props

Address PR feedback: switch pickManagedSettings from `for...in` to a guarded
`Object.keys` loop so only own enumerable properties are visited (managed-settings
bags are untrusted input) and absent channels are skipped explicitly.

Note: `for...in` over an undefined bag was already a no-op (never threw), so this is
a robustness/clarity improvement rather than a crash fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* policy: tidy pickManagedSettings unit suite

Drop two redundant cases (distinct-keys and standalone activeSources ordering,
both already covered by the headline and empty/absent tests) and fold the
non-contributing-middle-channel ordering check into the empty/absent snapshot.
Verified against the live node unit runner (all green).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 13:55:15 -07:00
Sandeep Somavarapu
be2fcc3ac7 agentHost: re-sync protocol types from AHP (AgentCapabilities now generated) (#323935)
Re-syncs common/state/protocol/* from the agent-host-protocol repo now that
AgentCapabilities has been upstreamed and merged there. PR #323625 had
hand-edited the generated channels-root/state.ts to add AgentCapabilities +
AgentInfo.capabilities?; this regenerates it from AHP so it is no longer a
DO-NOT-EDIT hand-edit that the next sync would silently overwrite.

The upstreamed shape evolved from the hand-edit: instead of flat
`supportsMultipleChats`/`supportsFork` booleans, the generated
AgentCapabilities now exposes an MCP-style nested `multipleChats?:
MultipleChatsCapability { fork? }` (presence signals support, absence =
unsupported). Consumers that produced/read the protocol capabilities were
adapted to the new shape with equivalent semantics; the vscode-internal
ISessionCapabilities (supportsMultipleChats/supportsFork) is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 20:53:52 +00:00
Kyle Cutler
4bedab10b9 Allow opening browser tabs in a dedicated group or window (#323930)
Browser: allow opening tabs in a dedicated group / window
2026-07-01 20:52:31 +00:00
Logan Ramos
cefb2508c4 Support server side powered model warnings (#323926)
* Support server side powered model warnings

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix comnments

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 20:51:34 +00:00
Raymond Zhao
444aca6149 chore: run npm audit fix (#323923) 2026-07-01 20:49:54 +00:00
Ulugbek Abdullaev
dd6118537b Support system-wide (OS global) keybindings (#323871)
* Add support for system-wide (OS global) keybindings

Allow user keybindings in keybindings.json to be marked with "systemWide": true so they register as operating-system global shortcuts that fire even when the window is not focused.

- Thread the systemWide flag through IUserFriendlyKeybinding, ResolvedKeybindingItem and KeybindingIO (read + serialize)
- New GlobalKeybindingsMainService owns Electron's globalShortcut, reconciles per-window registrations, resolves conflicts deterministically and routes triggers through the existing vscode:runAction path
- New renderer contribution syncs opted-in bindings to the main process, gated behind the experimental, off-by-default setting keyboard.enableSystemWideKeybindings with a one-time confirmation dialog
- Enable the GlobalShortcutsPortal feature on Linux/Wayland

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Avoid focusing the routing window on system-wide keybinding trigger

Force-focusing the routing (main) window before dispatching the command
pulled it to the foreground even when the command opens/reveals a different
window (e.g. openAgentsWindow reveals the agents window), producing a visible
flicker. Remove the force-focus and let the invoked command control what is
surfaced/focused, matching every other vscode:runAction sender.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Add workbench.action.focusWindow to raise the current window

Adds a generic command that brings the current window to the foreground and
focuses it using FocusMode.Force (which works even when the application is not
the active app). This lets users compose system-wide keybindings via
runCommands to reveal the window before running a command that surfaces UI in
it, e.g. [workbench.action.focusWindow, workbench.action.quickOpen].

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Address Copilot review: schema default, mnemonic comment, test grammar

- keybindingService.ts: correct 'systemWide' schema default to false to match
  KeybindingIO parsing (defaults to false when absent/invalid)
- systemWideKeybindings.contribution.ts: add '&& denotes a mnemonic' translator
  comment to the Enable button label
- keybindingEditing.test.ts: fix test title grammar (a user)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Always enable system-wide keybindings; drop the enablement setting

Removes the experimental `keyboard.enableSystemWideKeybindings` setting so the
feature is always active: any user keybinding with "systemWide": true is a
candidate. The one-time confirmation dialog is retained and now serves as the
opt-out - its Enable/Disable choice is persisted as a tri-state consent
(unset -> ask, granted -> register, denied -> stay off and never re-ask).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Make the first-run dialog an informational notice, not a permission prompt

The system-wide keybindings feature is always on, so the first-run dialog no
longer needs to grant/deny permission. Replace the Enable/Disable confirm dialog
with a single-button informational notice ("I Understand") shown once before the
first registration. Collapses the tri-state consent to a boolean acknowledged
flag; the feature has no decline path, so there is no stuck off-state.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-01 20:49:37 +00:00
vs-code-engineering[bot]
750210cffb Update distro commit (main) (#323919)
Update distro commit to 1ec113de

Co-authored-by: vs-code-engineering[bot] <122617954+vs-code-engineering[bot]@users.noreply.github.com>
2026-07-01 20:49:21 +00:00
Martin Aeschlimann
63cdabe105 copilot ah: test customization discovery and watching (#323916)
* copilot Ah discovery and watcher tests

* update
2026-07-01 20:49:00 +00:00
Giuseppe Cianci
0f9181d2b8 Merge pull request #323921 from microsoft/agents/codex-disable-image-generation
codex: disable hosted image_generation tool to fix CAPI 400
2026-07-01 22:24:09 +02:00
Justin Chen
1e84ee2eff chat ux cleanup: attachments and thinking icons (#323844)
* chat ux cleanup: attachments and thinking icons

* Scope clean diagnostics icon to problems tool

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address comments again'

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 20:22:14 +00:00
Ladislau Szomoru
59253d32ff Agents - clear changes when switching between sessions, but not when siwtching between changesets (#323918) 2026-07-01 20:17:14 +00:00
Giuseppe Cianci
24162abbe7 fix format 2026-07-01 21:12:16 +02:00
Giuseppe Cianci
fec50a4b95 signing commit 2026-07-01 21:08:58 +02:00
Giuseppe Cianci
52b5b0108c Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 21:07:51 +02:00
Giuseppe Cianci
f4f5253882 codex: disable hosted image_generation tool via feature flag
The bundled codex app-server advertises the hosted `image_generation`
tool whenever the developer's local `~/.codex` login uses a codex
backend (ChatGPT / agent-identity / PAT). `CodexProxyService` forwards
the request verbatim to the Copilot CAPI, which rejects it with
`400 unsupported_value` ("The requested tool image_generation is not
supported."). Disable the feature so codex never emits the tool.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 20:51:38 +02:00
dileepyavan
2daffe1ba0 Refactoring and prompts update (#323827)
* Add Responses API cache control markers

* Refactoring code

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Gate Responses API cache breakpoints by model support

* Disable Responses API reasoning summaries

* reverting cache commits

* Remove Responses API cache breakpoint handling

* gpt updates

* gpt updates

* gpt updates

* updating code for review comments

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 18:34:27 +00:00
Connor Peet
a9ecbe2626 Merge pull request #307995 from yogeshwaran-c/feat/exception-widget-copy-button
Add copy button to exception peek view
2026-07-01 11:30:48 -07:00
Vritant Bhardwaj
346c6caf10 Merge pull request #323907 from microsoft/agents/byok-model-default-setting
Disable GitHub Copilot utility models by default for BYOK models
2026-07-01 11:09:27 -07:00
Connor Peet
bcf60f063e Merge branch 'main' into feat/exception-widget-copy-button 2026-07-01 11:08:05 -07:00
Don Jayamanne
bcb41c82e4 Update @github/copilot-sdk version to 1.0.5 (#323911) 2026-07-01 18:04:23 +00:00
Osvaldo Ortega
38f7aedc6b Agents mobile: phone-aware dialog handler (#323741)
* Agents mobile (prototype): phone-aware dialog handler

Render IDialogService confirm/prompt as native bottom sheets on phone
layout, covering every modal in the Agents window in one place instead of
converting call sites individually.

The Agents window now registers a MobileDialogHandlerContribution (in place
of the standard web dialog handler) that drains the shared dialog model
through a MobileAwareDialogHandler. That handler delegates to the standard
BrowserDialogHandler off-phone and for text input / about, and on phone maps
the dialog model (message + detail + ordered buttons + optional checkbox)
onto a bottom sheet via the existing showMobileContentSheet primitive:
full-width stacked buttons at 44px, the safe action styled secondary, focus
moved into the sheet and restored on close.

Because confirmations from the sessions layer AND inherited chat / workbench
dialogs all flow through one handler, this covers them uniformly (e.g. delete
session, delete chat, discard changes, sign out) without per-call-site work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Agents mobile: drop the bespoke archive confirm sheet

The phone-aware dialog handler now renders every IDialogService.confirm as
a bottom sheet on phone, so the per-call-site mobileArchiveConfirmSheet is
redundant. Collapse ArchiveSectionAction back to a single dialogService.confirm
(matching the group "Mark All as Done" action) and delete the bespoke helper.

This also brings the section archive-all in line with the group archive-all:
both now flow through the handler and get the same sheet on phone, including
the "Do not ask me again" checkbox (safe to surface now that it renders in a
proper bottom sheet rather than the previously cramped desktop dialog).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: live checkbox state + dialog aria-describedby

- Track the chosen button and checkbox state across the whole interaction so
  a backdrop / Escape dismiss (or a checkbox toggle) returns the live values
  instead of a snapshot captured only on button click.
- Wire the message / detail to the sheet's role="dialog" element via
  aria-describedby so screen readers announce them when the sheet opens.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 10:45:16 -07:00
Rob Lourens
bc1d4637cb Update Copilot agent host descriptions (#323902)
* Update Copilot agent host descriptions

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Localize Copilot agent host descriptions

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 17:17:40 +00:00
Sandeep Somavarapu
3a1341a973 sessions: open the session when using Open in VS Code (#323900)
* sessions: open the session when using Open in VS Code

The "Open in VS Code" action in the Agents window only opened the
session's workspace folder, leaving the user to manually open Chat and
click into the session. Hand off the active session resource through a
new chatSessionToOpen open-window option so the opened window restores
both the folder and the session via the existing vscode:openChatSession
IPC, matching the web variant that already forwards the session.

Fixes #323200

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: address CCR feedback for Open in VS Code session handoff

Only send vscode:openChatSession when exactly one window is opened so the
session handoff is not sent to an ambiguous target, and condense the
inline handoff comment to a single line.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 17:13:35 +00:00
Ladislau Szomoru
ea888767fe Agents - add "Discard Changes" action into the multi-file diff editor (#323894)
* Agents - add "Discard Changes" action into the multi-file diff editor

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* 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>
2026-07-01 17:10:40 +00:00
Ben Villalobos
126f9a2aff Automations PR 2 (Runner) (#323810)
* feat(automations): add session runner — dispatches automation runs via sessions layer

Implements AutomationRunner:
- Creates sessions with configured prompt, mode, model, and permission level
- Dispatches via createAndSendNewChatRequest (background session)
- Tracks run lifecycle: recordRunStart/updateRun on IAutomationService
- Error notification on run failure
- Cancellation handling for mid-flight stops
- Sessions titled with automation name via renameChat

Supporting changes:
- ICreateNewSessionOptions: added modelId, modeId, permissionLevel, isolationMode, branch
- ISessionsProvider: added optional setMode/setPermissionLevel/setIsolationMode/setBranch
- ISendRequestOptions: added optional source field
- createAndSendNewChatRequest now returns ISession | undefined
- Implementation applies createOptions to provider before sending

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(automations): title the session before the agent host launches

Thread an optional title through ISendRequestOptions and apply it in
_sendFirstChat before sending, falling back to the query's first line.
The automation runner passes the automation name, so launch-time prompts
(e.g. worktree file transfer) show the automation name instead of the
prompt text. The post-send renameChat still sets the committed CLI title.

* Signing commit

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 17:02:41 +00:00
Logan Ramos
e0b6f9fabd Support rednering auto hover in model picker (#323896)
* Support rednering auto hover in model picker

* Update comments
2026-07-01 16:53:44 +00:00
Sandeep Somavarapu
b10844efce sessions: support Multi-Chat in the Claude agent-host harness (#323625)
* Support multiple chats for Claude agent-host sessions

Enable a single Claude (agent-host `provider === 'claude'`) session to own
multiple peer chats in the Agents window, matching the Copilot CLI experience.

- ClaudeAgent: add `_chatSessions` map plus `createChat` / `disposeChat` /
  `getChats`, per-chat persistence, lazy resume of restored peer chats, and
  per-chat routing on `sendMessage` / `abortSession` / `changeModel` /
  `changeAgent`. Fork a peer chat from a source chat's SDK conversation at a
  turn, falling back to a fresh chat when the fork anchor can't be resolved.
- Agent-host sessions provider: advertise `supportsMultipleChats` for the
  `claude` logical session type in addition to `copilotcli`.
- Update SESSIONS.md and ClaudeAgent tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: fix Claude peer-chat signal routing and harden multi-chat lifecycle

Fix additional (peer) chats in Claude agent-host sessions getting stuck in
progress: a peer chat passes its `ahp-chat` channel URI as the session's
`sessionUri`, but `ClaudeAgentSession` derived its routing channel via
`buildDefaultChatUri(sessionUri)`, double-encoding it so the renderer never
matched the channel. Use the chat URI directly when `sessionUri` is already an
`ahp-chat` channel.

Also harden the peer-chat lifecycle per code review:
- serialize all catalog read-modify-write on the parent session id (createChat /
  disposeChat / _updateChatCatalogModel) to avoid lost updates
- hold the per-chat lock across both materialize and send so disposeChat /
  disposeSession serialize against an in-flight turn (no use-after-dispose)
- make _disposeChildChats async + per-chat serialized to avoid zombie entries
- abort provisional peer chats up front during shutdown
- route setPendingMessages steering to peer chats
- shape-guard the persisted catalog model

Refs https://github.com/microsoft/vscode/issues/322776

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: thread chat channel through setPendingMessages for peer-chat steering

Address CCR feedback: peer-chat steering was non-functional because
`AgentSideEffects._syncPendingMessages` always dispatched the parent session URI
to `agent.setPendingMessages`, so the Claude peer-chat routing branch was never
reached and steering landed on the default chat.

Add an optional `chat?` param to `IAgent.setPendingMessages` (mirroring
sendMessage/abortSession/changeModel), dispatch the chat channel from
`_syncPendingMessages` (undefined for the default chat), and route via it in
ClaudeAgent. Copilot/Codex 3-param implementations remain valid and unchanged.

Adds an AgentSideEffects dispatch test asserting the peer chat URI is forwarded
as the `chat` arg (and is undefined for the default chat).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: unify Claude session/peer-chat plumbing into one entry container

Address review feedback (connor4312): stop overloading session/chat URIs and
the parallel-map split that special-cased peer-chat dispatch.

- ClaudeAgentSession now takes an explicit `chatChannelUri`; its `sessionUri`
  is always the real session URI and is never a chat URI
  (`isAhpChatChannel(sessionUri)` can no longer be true). Per-chat resources
  (db, overlay, config scope, server-tool advertise) key off a derived
  `_storageUri` so peer chats stay isolated without overloading `sessionUri`.
- Drop the parallel `_chatSessions` map: a single `_sessions` map of
  `ClaudeSessionEntry` containers now holds each session's default chat plus its
  peer chats. Dispatch resolves a chat via `_findChat(session, chat)` / the
  entry, and teardown disposes the whole entry (main + peers) via
  `_teardownEntry`.
- Unify peer-chat message reconstruction with `getSessionMessages` via a shared
  `_reconstructTurns(sdkId, routingUri, primeOn)`; remove the duplicated
  `_getChatMessages`.

No behavior change to storage keying (main -> session URI, peer -> chat URI).
All ClaudeAgent / AgentSideEffects / CopilotAgent / AgentService node tests pass
(425 claude tests).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: add opaque providerData to chat catalog + multi-chat tests

Wave A + gate G-B1 of the multi-chat unification:
- AgentHostStateManager: add an opaque, agent-owned `providerData?: string`
  to peer-chat catalog entries (addChat/restoreChat) plus getChatProviderData.
  Stored verbatim and never parsed; the default chat carries none. This becomes
  the single source of truth for a peer chat's backing-conversation token,
  replacing the agents' private copilot.chats/claude.chats persistence.
- Add characterization tests for the StateManager catalog (default chat, add/
  remove/restore, summary roll-up) and peer-chat + restore round-trip tests for
  CopilotAgent and ClaudeAgent, guarding the upcoming de-dup waves.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: orchestrator owns the peer-chat catalog (Wave B de-dup)

Make AgentHostStateManager's catalog the single source of truth for peer
chats, removing the agents' private copilot.chats/claude.chats persistence:

- agentService: restore peer chats by enumerating the orchestrator's own
  catalog (using the opaque providerData blob) instead of agent.getChats;
  call materializeConversation(chatUri, providerData) before getSessionMessages
  so the agent re-attaches its conversation backing; persist providerData on
  createChat and re-persist on onDidChangeConversationData.
- IAgent: createChat returns IAgentCreateChatResult { providerData? };
  add materializeConversation + onDidChangeConversationData.
- CopilotAgent / ClaudeAgent: stop writing their private *.chats catalogs;
  shrink _chatSessions to a live-only map; decode providerData to rebuild the
  chatUri -> sdkSessionId mapping; emit onDidChangeConversationData on per-chat
  model/fork change. A one-time legacy *.chats READ (triggered by an undefined
  providerData blob) migrates in-flight sessions.

Typecheck, valid-layers-check, and the agentService/Copilot/Claude/StateManager
suites (511 tests) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: add scope/conversation IAgent surface + dispatch mapper (gate G-C1)

Introduce the orchestrator-owned scope/conversation vocabulary on IAgent,
additively alongside the legacy (session, chat?) surface (kept as a compat
shim until waves C2-C5 migrate each agent):

- IAgent: add createScope/disposeScope and an IAgentConversations surface
  (createConversation/disposeConversation/getMessages/fork, conversation-
  addressed sendMessage/abort/changeModel/changeAgent).
- AgentService: map feature-level (session, chat) -> (agent, scope,
  conversation) and own default-chat resolution; resolveConversationUri helper.

Typecheck, valid-layers-check, and the AgentService dispatcher suites
(112 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: agents adopt scope/conversation surface (Wave C)

CopilotAgent, ClaudeAgent and CodexAgent now implement the new scope/
conversation IAgent surface (createScope + conversations:
createConversation/disposeConversation/getMessages/fork and conversation-
addressed sendMessage/abort/changeModel/changeAgent), and agentSideEffects
threads it through where straightforward. The legacy (session, chat?) compat
shim is intentionally retained for now; it is removed centrally in gate G-C2.

Typecheck, valid-layers-check, and the Copilot/Claude/Codex/AgentService
suites (563 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: remove legacy (session, chat?) shim from IAgent (gate G-C2)

With every agent migrated to the scope/conversation surface (Wave C), drop
the agent-facing legacy methods — sendMessage(session,chat,...)/createChat/
disposeChat/getChats and the chat?-suffixed abort/changeModel/changeAgent —
leaving only the conversation-addressed surface on IAgent. AgentService,
agentSideEffects and the three agents migrate their remaining call sites; the
mock agent is updated to the new surface. The orchestrator-facing
IAgentService/IAgentConnection (session,chat) API and the wire protocol are
unchanged — they remain the (session,chat) -> conversation mapping boundary.

Net -209 lines. Typecheck, valid-layers-check, and the Copilot/Claude/Codex/
AgentService suites (559 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: add harness spawn-conversation channel + catalog routing (gate G-D1)

Generalize the subagent_started/subagent_completed signals into a first-class
membership channel: IAgent.onDidSpawnConversation({ scope, conversation,
parent? }) / onDidEndConversation(conversation). AgentService subscribes on
provider registration and routes spawned conversations straight into the
chat catalog (addChat/removeChat), so harness-spawned chats (teams, fleet,
subagents) and user-driven chats share ONE catalog path, preserving the
parent relation. Per-agent emission of these events lands in Wave D.

Typecheck, valid-layers-check, and the AgentService suite (107 passing) pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: agents emit spawn events + capability-driven UI gating (Wave D)

- CopilotAgent / ClaudeAgent emit onDidSpawnConversation/onDidEndConversation
  from their subagent/fan-out paths, so harness-spawned chats flow into the
  shared catalog via the G-D1 channel (carrying the parent relation).
- IAgentDescriptor advertises IAgentCapabilities { supportsMultipleChats,
  supportsFork, supportsTeams }; the agent-host sessions provider maps these
  onto ISessionCapabilities instead of the hardcoded
  supportsMultipleChats(logicalSessionType) session-type check, and exposes
  supportsFork/supportsTeams context keys so UI gates generically with no
  per-harness branches.

Typecheck, valid-layers-check, and the agentHost + sessions provider suites
(1725 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: test default-chat rename is restored on restoreSession

Re-add coverage for restoring a default chat's independently-persisted custom
title (customChatTitle:<defaultChatUri>), homed in the dedicated restoreSession
suite using the localService + TestSessionDatabase pattern. A version of this
test arrived via a merge but was misplaced in the createChat suite; this puts it
in the right place. The behavior itself lives in AgentService.restoreSession.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove unused supportsTeams capability

The supportsTeams capability was fully plumbed (protocol to agents to
ISessionCapabilities to SessionSupportsTeamsContext) but had zero
consumers: no when-clause and no widget read it. Harness-spawned
teams/subagents surface automatically via onDidSpawnConversation
regardless of any flag, so this was speculative dead weight. Remove all
13 references across 9 files. supportsMultipleChats and supportsFork are
left untouched as they are actually consumed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: unify subagent catalog membership onto the spawn channel (DR1)

Make the spawn-conversation channel the single owner of subagent catalog
membership, removing the duplicate add path:

- AgentSideEffects._handleSubagentStarted no longer calls addChat; it keeps
  only the subagent lifecycle (ChatTurnStarted, _subagentChats tracking, parent
  tool-call Subagent content, buffered-signal drain, teardown).
- AgentService now sequences a subagent_started/subagent_completed signal onto
  the spawn-channel handlers (_onConversationSpawned/_onConversationEnded) via a
  new onDidSessionProgress subscription registered BEFORE the side-effects
  progress listener. This deterministically guarantees the subagent chat exists
  in the catalog before its turn is started, independent of when the agent
  registers its own subagent->spawn bridge (addChat/removeChat are idempotent).
- Extract the subagent-signal -> spawn-event mapping into shared helpers
  (subagentSpawnConversationEvent/subagentEndConversation) reused by the agents'
  bridges and the AgentService sequencer.

Adds a "subagent membership sequencing" suite: exactly one catalog entry with
parent origin/title/started turn regardless of order, buffered inner-signal
drain, and completion teardown. Typecheck, valid-layers, and the agent suites
(567 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: add multi-chat architecture spec

Living architecture spec for the agent-host multi-chat design (scope/session vs
conversation/chat, orchestrator-owned catalog, opaque providerData, unified
spawn channel, capability gating) with mermaid diagrams. Kept in sync with the
implementation, like SESSIONS.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: legacy peer-chat migration (BC1) + Copilot session container (F2)

Two changes to the Copilot/Claude agents and the orchestrator restore path:

BC1 - backward-compatible restore of legacy peer chats: sessions whose
additional chats were persisted only in the old agent-owned copilot.chats /
claude.chats format (no orchestrator peerChats catalog) previously restored
with those chats invisible. AgentService now performs a one-time migration when
the orchestrator catalog is absent (undefined, not []): it enumerates the
agent's legacy chats via a new migration-only IAgent.listLegacyChats, restores
them through the normal catalog path, and writes the peerChats key so the drain
runs once. Fixes the stale JSDoc that claimed a fallback removed in G-C2.

F2 - collapse CopilotAgent's default-vs-peer _sessions/_chatSessions two-map
split into a single _sessions map of a CopilotSessionEntry container (mirroring
ClaudeSessionEntry): the entry holds the default chat plus a nested _peerChats
map. Removes the special-casing Connor flagged on #323625.

Typecheck, valid-layers-check, and the AgentService/Copilot/Claude suites
(570 passing, incl. the migrate-once / empty-catalog / new-format restore
cases) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: rename agent scope/conversation surface to session/chat (N1)

Collapse the agent-facing vocabulary back to session/chat, so the whole stack
(protocol, orchestrator, UI, agents) speaks one language. The scope/conversation
terms were a 1:1 veneer over concepts already named session/chat elsewhere (the
create* methods even returned IAgentCreateSessionResult). The sessionUri vs
chatChannelUri TYPE separation is preserved — this is a naming change only.

- IAgent: createScope/disposeScope -> createSession/disposeSession; the
  conversations surface (IAgentConversations) -> chats (IAgentChats) with
  createChat/disposeChat/getMessages/fork + conversation-addressed send/abort/
  changeModel/changeAgent now chat-addressed; materializeConversation ->
  materializeChat; onDidSpawn/End/ChangeConversation* -> onDidSpawn/End/ChangeChat*.
- Types: IAgentSpawnConversationEvent -> IAgentSpawnChatEvent,
  IAgentConversationDataChange -> IAgentChatDataChange; drop
  IAgentCreateConversationOptions (reuse IAgentCreateChatOptions).
- Helpers: resolveConversationUri -> resolveChatUri and the private
  _*Conversation* members across AgentService/agents renamed to _*Chat*.
- IAgentService/IAgentConnection/protocol/UI names unchanged (already session/chat).
- Reconcile agentSideEffects tests to the renamed chat surface (mock URI
  normalization) and update MULTI_CHAT_ARCHITECTURE.md terms/diagrams.

Typecheck, valid-layers-check, and the agent suites (686 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: align architecture diagram label with chat terminology

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: align multi-chat spec terminology with the session/chat rename

Refine MULTI_CHAT_ARCHITECTURE.md wording after N1: the default chat's backing
SDK *session* (not "SDK chat") is the session, peer chats are backed by their
own sdkSessionId, and clarify the (session, chat) -> (agent, session URI, chat
URI) mapping label and the per-chat state description.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: group refactor-added helpers into logical units (NS1)

Reduce loose top-level exports in common/agentService.ts introduced by the
multi-chat refactor (the pre-existing config/env helpers are left untouched):

- Move resolveChatUri to common/state/sessionState.ts next to its sibling
  chat-URI helpers (buildChatUri/buildDefaultChatUri/isDefaultChatUri/
  parseChatUri) — its logical home.
- Group the subagent signal -> spawn-channel mappers into an
  `export namespace SubagentChatSignal { toSpawnEvent, toEndChat }` (mirroring
  the existing AgentSession namespace), updating the Copilot/Claude bridges and
  AgentService._sequenceSpawnedChat call sites.

Pure move/regroup, no behavior change. Typecheck, valid-layers-check, and the
agent suites (686 passing) all pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Make ISession.capabilities observable so late-hydrating capabilities reconcile

The agent-host adapter exposed `capabilities` as a live plain getter reading
the connection's root state. When `rootState.agents[].capabilities` hydrated
after a session's first `SessionState`, existing sessions were never
reconciled: a multi-chat catalog processed while `supportsMultipleChats` was
still `false` stayed collapsed to `[defaultChat]`, and the
`supportsMultipleChats`/`sessionSupportsFork` context keys stayed stale because
a plain getter cannot be tracked by the `setActiveSessionContextKeys` autorun.

Change `ISession.capabilities` to `IObservable<ISessionCapabilities>`. The
agent-host adapter derives it from `connection.rootState` (bridged via
`observableFromEvent`) with `derivedOpts` + `structuralEquals`, and re-applies
the last `SessionState` catalog in an autorun when capabilities change. Static
providers wrap their capabilities in `constObservable`; consumers read
`.read(reader)` (context keys) or `.get()` (one-shot).

Adds a regression test and updates SESSIONS.md and the sessions skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Keep completed subagent chats live (fix subagent integration tests)

A DR1 regression conflated 'subagent turn completed' with 'chat removed':
a subagent_completed -> removeChat path tore the child subagent chat out of
the catalog on completion, so subscribing to it after the parent turn
completed failed with 'Resource not found'. A completed subagent chat must
stay live and subscribable (merely hidden from listSessions), with its turn
completed via AgentSideEffects.completeSubagentSession; subagent chats are
removed only on session teardown via removeSubagentSessions.

- agentService._sequenceSpawnedChat: handle spawn only (no removal on completion)
- copilotAgent/claudeAgent spawn bridges: stop firing onDidEndChat on completion
- remove now-unused SubagentChatSignal.toEndChat (keep toSpawnEvent)
- keep onDidEndChat as a generic membership-removal hook
- tests: assert the subagent chat survives subagent_completed and that
  completion does not fire onDidEndChat

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add non-opaque backingSession to IAgentCreateChatResult

Introduces a first-class, non-opaque backingSession URI on the peer-chat
create result so the orchestrator can correlate and suppress a peer chat's
backing SDK session. Kept distinct from the opaque providerData blob so the
providerData opacity invariant is preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Report peer-chat backingSession from Claude and Copilot agents

ClaudeAgent._createChat mints a fresh top-level SDK session per peer chat in
the same store its listSessions enumerates, so it now returns that session as
backingSession for the orchestrator to suppress. CopilotAgent sets it too for
uniformity (harmless — its peer sessions already don't leak).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Filter peer-chat backing sessions from the top-level session list

createChat now stamps a persisted peerChatBacking marker into the backing
session's database, and listSessions drops any enumerated session carrying it
(batched into the existing metadata overlay, mirroring the subagent filter).
Fixes Claude peer chats leaking as separate top-level sessions. Adds a unit
test covering the filter and its persistence across a restart, plus doc
invariant I7.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Share peer-chat scaffolding across Claude & Copilot agents

Extract the near-verbatim multi-chat peer scaffolding shared by the Claude
and Copilot agents into a new node-target module
`src/vs/platform/agentHost/node/agentPeerChats.ts`:

- Move the opaque `providerData` codec (`IPersistedChat`,
  `encodeProviderData`, `decodeProviderData`) into the shared module and
  export it. Use Claude's stricter `model` validation, which is a superset
  of Copilot's unconditional cast. Both agents import it and drop their
  private copies.
- Add a generic `AgentSessionEntry<TSession extends IDisposable>` container
  holding the optional default session plus the peer-chat map. Rewrite
  `CopilotSessionEntry` as an empty subclass and `ClaudeSessionEntry` as a
  subclass that narrows `session` to non-optional.

Behavior-identical refactor; existing Agent* suites stay green.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Persist migrated legacy peer chats in a single atomic catalog write

`_migrateLegacyPeerChats` wrote the migrated peer chats to the orchestrator
catalog one entry at a time in a loop. Each `_persistPeerChat` is a separate
read-modify-write of `PEER_CHATS_METADATA_KEY`, so after the first write the key
is present containing only the first entry. If the agent-host process crashed
(OS kill, power loss, forced restart) after write 1 but before write N, the
catalog was left partial; on the next restart `_readPersistedPeerChatCatalog`
returns that subset (not undefined), the catalog-present branch short-circuits,
and migration never re-runs -- chats 1..N-1 are lost forever.

Write the whole migrated set in a single atomic `_enqueuePeerChatCatalogWrite`,
so the key is absent before and complete after; no partial catalog can survive a
crash mid-migration. Adds regression tests asserting the full set is persisted in
one write and that a rejected write leaves the key absent (never a subset).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 16:53:16 +00:00
Dirk Bäumer
132a773459 Enhance telemetry for findTextInFilesTool with requested max results (#323892)
* Enhance telemetry for findTextInFilesTool with requested max results

* Fix telemetry maxResults parameter handling in FindTextInFilesTool

* Fix GDPR comment
2026-07-01 16:44:27 +00:00
Giuseppe Cianci
92592a639e Merge pull request #323881 from microsoft/fix-codex-smoke-cache
Re-enable Codex smoke test with a fast-fail native-binary pre-check
2026-07-01 18:34:46 +02:00
vritant24
33b9f3a78b feat: add configuration for using Copilot models in BYOK scenarios and update utility model handling 2026-07-01 09:30:45 -07:00
Sandeep Somavarapu
21829d95c1 sessions: persist Customizations section collapse state across reloads (#323848)
The Customizations section in the Agents sidebar always reset to expanded
on reload because AICustomizationShortcutsWidget initialized _collapsed to
false and never persisted the state.

Read and store the collapsed state via IStorageService (StorageScope.PROFILE)
so the section restores its collapsed/expanded state on reload. Apply the
persisted state to the DOM after each render instead of hard-resetting to
expanded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 16:13:26 +00:00
Ladislau Szomoru
9be97f69c2 Agents - cleanup branch changes subscription (#323887)
* Agents - cleanup branch changes subscription

* Fix, skip tests that need to be refactored
2026-07-01 16:04:53 +00:00
Vritant Bhardwaj
1ae9f8e660 Merge pull request #322977 from microsoft/agents/byok-inference-path
Add Initial BYOK Support to Local Copilot Agent Host
2026-07-01 08:39:27 -07:00