* Add tool search to Copilot agent host
* Address review: alias-aware tool-search gating, drop transient candidates, cover prompt branch
- Compute the tool-search capability decision from the family-aliased model in
both the launcher and CopilotAgentSession so an aliased preview model is no
longer rejected and the two stay in agreement.
- Strip the transient tool-search candidate corpus from the completed tool
call's _meta so repeated searches don't bloat synchronized session state or
persist across reconnects.
- Add active/inactive + composition tests for the tool-search prompt line at
both the unit and prompt-registry layers, plus a model-family alias
regression test for tool-search gating.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove obsolete tool-search start barrier
* Address tool-search review feedback
* Use the extension's existing tool-embedding cache for Agent Host search
* Address review: keep server tools eager, harden tool-search candidate corpus
- Force server-provided SDK tools to defer:'never' so they stay eager and are
not deferred behind tool_search.
- Default missing candidate descriptions to '' when building the tool-search
corpus, so the all-or-nothing metadata reader never drops a valid corpus.
- Drop the unused inputSchema field from the tool-search candidate corpus
(name + description are all the embeddings ranker consumes).
- Use the client-facing tool name in the custom-tool auto-approve membership
check so a deferred tool_search runtime name resolves correctly.
- Remove a redundant conjunct in _clientToolName already implied by
_isToolSearchActive().
* 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>
* Temporarily disable GPT tool search
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Show all cloud sessions in the agents window regardless of active repo
The v2 Task backend scoped the cloud session list to the active
workspace's repositories, so the agents window only showed sessions
for the currently selected repo. Use the global user-scoped list when
in the agents window, matching the v1 Jobs backend behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use agents-window scope for cloud session background refresh and polling
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Two behavior-preserving improvements to the xtab (NES) neighboring-files context, both keyed on distinguishing open-tab neighbors from language-service "related" files:
1. Related-file snippets omit line numbers in the prompt (matching NES's own language-context path); open-tab snippets keep them.
2. New neighborFiles.includeRelatedFiles option (default true) can disable the related-files context; when off, the related-files/LSP work is skipped entirely.
Provenance is tagged once at the source: getNeighborFilesAndTraits stamps isFromRelatedFile on each related doc via isRelatedNeighboringFileType(type), getSimilarSnippets propagates it (and the source uri) onto every snippet and guarantees both on its return type, and SimilarFilesContextService reads the flag directly. Defaults are unchanged, so this is a no-op until the new exp key is flipped.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1bb7414b-49be-41eb-b86b-bc8d7a319268
* Fix NES cached suggestion not shown after rebasing over user indentation
When a cached NES suggestion is a line-based insertion that restates the
line's indentation (e.g. predicting " return [" on an empty body line)
and the user tabs to indent that line, tryRebaseCacheEntry served the raw,
non-minimized edit whose range spans the indentation the user already
typed. That edit is not a clean at-cursor insertion, so the core
inline-completions renderer drops it and the cached suggestion is silently
not shown.
Minimize the served rebased edit via removeCommonSuffixAndPrefix so the
indentation the user already typed is stripped, yielding a clean at-cursor
insertion that renders as ghost text. This is semantically neutral (same
apply() result on the current document) and idempotent for the downstream
isRejectedNextEdit check. Minimizing is done at the cache serving layer
rather than in editRebase, which intentionally keeps the full line edit for
response/telemetry fidelity.
Adds a regression test covering the empty-line + tab scenario.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550
* Salvage NES suggestion on rebaseFailed for indentation mismatch
The previous commit minimized the served edit in the rebase *success*
branch, but that path already renders as ghost text, so the change was a
semantic no-op and its test modeled an artificial success path.
The real bug is in the rebase *failure* path: strict rebase matches
indentation literally, so when the user re-types a line's leading
whitespace differently than the model predicted (e.g. pressing Tab to
insert a tab character, or a different number of spaces, on an empty body
line), the whole suggestion is silently dropped and nothing is shown.
Salvage that case in the cache layer: on `rebaseFailed`, re-anchor the
model's still-valid content as a clean at-cursor insertion that respects
the indentation the user actually typed. This mirrors the reconciliation
the engine already performs when the indentation matches, is a faithful
representation of the model's intent (so it upholds the display layer's
soundness invariant), and only fires when the suggestion would otherwise
be dropped.
Revert the no-op minimization and replace the misleading regression test
with a faithful one covering the tab-character drop scenario (which fails
without this salvage).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550
* Gate NES indentation-mismatch salvage behind a setting
Put the rebaseFailed re-anchoring behavior behind a new team-internal,
experiment-based setting `chat.advanced.inlineEdits.reanchorContentOnIndentationMismatch`
(default off) so it can be rolled out or disabled independently.
Thread the flag through `NesRebaseConfigs` (built in `_getNesRebaseConfigs`)
and gate the `tryReanchorContentAfterIndentation` salvage call on it. Add a
regression test asserting the suggestion is dropped when the setting is
disabled, alongside the existing salvage test with it enabled.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* agentHost: reduce extension host session scanning
Skip shared Copilot CLI JSONL watching when Agent Host is the default provider for the current window. Mark Agent Host SDK sessions with a distinct client name and replace legacy per-session ownership stats with one directory index.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: test Copilot client identity
Capture SDK create and resume configs to ensure Agent Host always emits the client name consumed by extension-host ownership filtering.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Forward CAPI assignment context to VS Code core telemetry
Add a proposed API scode.env.setTelemetryExperimentProperty that
allows trusted built-in extensions to set experiment properties on
VS Code's core telemetry pipeline.
The Copilot extension uses this to forward capi.assignmentcontext
(received via X-Copilot-Experiment and x-copilot-api-exp-assignment-context
response headers from CAPI) so that it appears on all VS Code telemetry
events, not just the Copilot extension's own events.
Flow:
1. CAPI responds with experiment headers
2. Copilot extension extracts them into serverExperiments
3. TelemetryService.setSharedProperty('capi.assignmentcontext', value)
4. Override forwards to vscode.env.setTelemetryExperimentProperty()
5. MainThreadTelemetry calls ITelemetryService.setExperimentProperty()
6. Property appears on all subsequent VS Code telemetry events
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix: resolve CI failures - eslint and Copilot typecheck
- Remove 'VS Code' from proposed API JSDoc (eslint vscode-dts-vscode-in-comments rule)
- Use type assertion for proposed API call in Copilot extension to avoid
TS2339 since the extension's tsconfig doesn't include proposed .d.ts files
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix: replace 'as any' with typed Record cast for eslint compliance
- Use Record<string, unknown> instead of 'as any' to satisfy no-explicit-any
- Narrow API JSDoc to per-window scope (matching existing TAS pattern)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Few updates
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Vijay Upadya <41652029+vijayupadya@users.noreply.github.com>
* Add assignment context header to WebSocket connections
Override createResponsesWebSocket in BaseCAPIClientService to inject the
X-Copilot-Client-Exp-Assignment-Context header, matching the behavior
already present in makeRequest for HTTP calls.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Add unit tests for createResponsesWebSocket assignment context header
Tests verify:
- Header is injected when abExpContext is set
- Headers object is created when none exists
- Headers are not modified when abExpContext is unset
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Remove new capiClient websocket test file
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Fix new cloud session disappearing and misgrouping after commit
The Agents window (vs/sessions) drove a new cloud (RemoteNewSession) agent
session through the wrong commit path, causing it to disappear ~5s after
delegating, and then group under "Unknown" / flip its repo label once it did
appear. Three related fixes:
1. Wait for the committed resource on cloud sessions. A cloud session commits
a new resource mid-request (untitled -> /task/<id>), like Copilot CLI, so
_sendFirstChat now routes RemoteNewSession through _waitForCommittedSession
instead of waiting on the stale untitled resource (which timed out and
removed the session). The wait is also deferred (skips the response-complete
race, longer timeout) because the cloud commit is delayed by a confirmation
round-trip and network delegation.
2. Attach owner/name metadata to PR-less task cards so a freshly created task
groups under its repo instead of "Unknown"/"Other" until a PR resolves.
Repo identity is hoisted from PullArtifactRef.repo to CloudSessionData.repo
(a task has a repo regardless of a pull artifact); resolvePullArtifact now
takes repo as an explicit argument.
3. Consolidate the repo label. Both the new-session workspace and the committed
session adapter now derive an owner/repo label via a shared
githubRemoteRepoLabel helper, so a cloud session stays in the same group
before and after commit (no more microsoft/vscode -> vscode flip).
Adds a regression test for the cloud commit-swap.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Comments
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review: convertToApiChatMessage now defaults to not emitting the
cache_control sentinel (fail closed), and ExtensionContributedChatTokenizer
mirrors the request path so provideTokenCount never leaks it to non-cache-aware
providers. Condense comments per review.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The host injects an Anthropic cache-breakpoint (cache_control data part) into
tool results for every non-messages endpoint, including third-party providers
(Ollama, custom) that can't recognize it and serialize it verbatim into their
upstream request. Gate emission in convertToApiChatMessage so the sentinel only
reaches vendors whose converters handle it (anthropic, gemini, openrouter).
Fixes#313920
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: normalize tool call IDs across model switches
Kimi requires function-indexed tool call IDs, while Anthropic accepts only a restricted character set. Normalize outbound request copies for each provider without mutating stored conversation history.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: avoid collisions in normalized tool call IDs
Reserve valid IDs before allocating sanitized Anthropic IDs, then reuse the request-scoped mapping for matching tool results.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>