Gates the collapse-to-long-context-only behavior behind the new
github.copilot.chat.preferLongContext.enabled setting (default off), so
models with a free long context window (e.g. Claude) show both the default
and long context options again. Covers the main chat picker, CLI picker, and
the Agents window.
Fixes#323936
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ClaudeSonnet5Prompt (Sonnet 4.6 base + scope/interface/effort append) via new renderAppendedInstructions hook, gated behind chat.claudeSonnet5Prompt.enabled
- Rename Claude 4.7 Opus prompt/config to 4.8, add completionDiscipline, plan/explain restraint, tool triggering and terminal run-once guidance; gated behind chat.claude48OpusPrompt.enabled
- Opus 4.7 now falls through to the generic optimized Opus prompt
* 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
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Remove workspace+folder configurability of OTel settings (scope: application)
for both the Copilot extension settings and the agent-host OTel settings.
Settings are now user-only and policy-deliverable.
- Drop the workspace-trust capability gate, the captureContent disclosure
modal, and the yellow chat-input banner.
- Collapse the chat-input pill to a single broadcast indicator ($(broadcast))
shown whenever OTel is on; remove the statusCapturing command.
- Surface OTel state in the Copilot chat status dashboard as a single row
with the endpoint and an inline [Manage] command link.
* 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.
* OTel visibility in Copilot Chat UI (#47)
* [msrc/1.123] 114763
* Add maxAttributeSizeChars configuration to OpenTelemetry settings
---------
Co-authored-by: Zhichao Li <zhichli@microsoft.com>
(cherry picked from commit 042dc59dbb51f58ef03a6909d5dfb0292a6b2576)
(cherry picked from commit be6ab8b589)
* Prompt before connecting to non-loopback remote host:port authorities (#46)
A direct `<host>:<port>` remote authority (no resolver `+` prefix) bypasses
resolver extensions and connects straight to the given server. Since this form
can originate from untrusted sources (e.g. the `remoteAuthority` of a
`.code-workspace` file), a crafted workspace could silently point the window's
extension host backend at an attacker-controlled server.
Centralize a confirmation prompt at the connection point in the renderer:
when resolving a direct authority whose host is not loopback (localhost,
127.0.0.1, ::1), ask the user to confirm before connecting and abort if
declined. Add `isLoopbackHost` helper and tests.
(cherry picked from commit 9505d0fca49eadb707c450d18dcb41a46b720a9e)
(cherry picked from commit 9673132502)
* GitHub - improve host parsing (#48)
(cherry picked from commit 4b6e2467dbd828018d602f73cc25d1b11f699d2c)
(cherry picked from commit 9fea92e141)
* path traversal fix (#50)
* fix path traversal
* fix compilation
(cherry picked from commit 9b31ff896671125cbfc65f33731c4a99660d6201)
(cherry picked from commit a703741497)
* Path - improve isEqualOrParent calculation (#49)
(cherry picked from commit 0f1ba1ea103757f3023cc1f9c3eb7327c3ec4b02)
(cherry picked from commit 5927baa7af)
---------
Co-authored-by: Zhichao Li <Li.Zhichao@microsoft.com>
Co-authored-by: Zhichao Li <zhichli@microsoft.com>
Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
Co-authored-by: Ladislau Szomoru <lszomoru@microsoft.com>
Co-authored-by: Sandeep Somavarapu <sasomava@microsoft.com>
chat: custom trajectory compaction model (usePrismCompaction) (#316114)
Route conversation-history compaction (foreground /compact and background auto-compaction) to the dedicated trajectory-compaction CAPI model when chat.conversationCompaction.usePrismCompaction is enabled and the agent model matches chat.conversationCompaction.prismModelFilter. When the flag is off, behavior is unchanged from upstream.
Squashed rebase of PR #316114 onto main. Conflicts resolved by unioning additive changes: combined main's isCAPIEndpoint import with the PR's APIUsage import in agentIntent.ts, and kept both main's longToolCallCachePreservation.* and the PR's conversationCompaction.* nls keys. main's #320273 background-summarization anchor-round fix is preserved (backgroundSummarizer.ts unchanged).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* claude: load Agent SDK from companion extension instead of bundling
Extracts SDK loading behind IClaudeAgentSdkLoaderService with two
implementations (bundled require-based loader and a VS Code extension
loader for ms-vscode.vscode-claude-sdk), selected once at construction
by a routing service driven by experiment config. Adds install-on-demand
UX that surfaces an install button when the SDK extension is missing,
with cancellation-aware retry/fallback in the chat handler.
* claude: address PR feedback on SDK loader
- Use CLAUDE_SDK_EXTENSION_ID constant in install UX instead of hardcoded id, with placeholder in the localized error message.
- Clarify install-timeout setting description: waits for install/detection only, not activation.
chat.advanced.summarizeAgentConversationHistoryThreshold now accepts either a ratio of the model's context window (0 < value <= 1, e.g. 0.8 for 80%) or an absolute token count (value >= 100). A new resolveSummarizeThresholdTokens() helper resolves the value; ratios track model/context-size changes automatically. Values in the ambiguous (1, 100) gap are rejected so a typo like 80 (meant as 80%) fails loudly instead of compacting after 80 tokens.
* Initial attempt. Send dummy user requests every 5 mins
* Modified the probe message
* Modified timeouts
* Removed artificial 2 min delay
* Addressing Copilot suggestions
* Made it configurable
* Make probe limit exp based
* Typo in docstring
* Enabled only for execution subagent
* Changed default number of probes to 1
* Fixed formatting in package.json
* Override userInitiatedRequest to false for probe messages
* Added a subtype keep-alive-probe in telemetry
* Updated telemetry to keep subtype unchanged but use a different source
* Address review: scope keep-alive to Anthropic + current round, constant-1 finishedCb
* Simplify keep-alive endpoint resolution: separate lookup, no flag-off reordering
---------
Co-authored-by: bhavyaus <bhavyau@microsoft.com>
* Added gemini in exec subagent description and gated on gemini availability
* Set Gemini as default execution subagent model and enabled by default
* Modified the description of the executionSubagent.enabled setting
Don't emit empty <customizationsUpdate> on steering turns
Fixes#317763
Terminal steering requests sent from runInTerminalTool.ts don't forward an
instructionContext, so chatServiceImpl short-circuits collectInstructions()
to [] and the vscode.customizations.index variable is absent for those turns.
The old freeze/drift consumer in agentPrompt.tsx treated that absence as
'all customizations removed' via 'effectiveCurrent = currentValue ?? ''',
emitting an empty <customizationsUpdate> block whose own text says it
'supersedes the system prompt' — falsely telling the model that all
skills/instructions/agents had been wiped mid-task and churning the cache
tail.
Gate drift emission on 'currentValue !== undefined' so an absent variable
preserves the frozen system-prompt listing instead of falsely signalling
removal. Also graduates the experimental
'github.copilot.chat.freezeCustomizationsIndex' setting (it was already
default true on onExp).
* Cloud Agent: Tasks API experimental setting and backend
Introduces a CloudAgentBackend seam with two implementations:
- JobsApiBackend wraps the existing sweagentd Jobs API (default, no behavior change).
- TaskApiBackend implements the new Mission Control Task API and currently uses a StubTaskApiClient pending CAPI routing.
Selection is controlled by the new 'github.copilot.chat.cloudAgentBackend.version' setting ('v1' = Jobs API, 'v2' = Task API). The setting is tagged experimental and defaults to 'v1', preserving existing behavior for legacy users.
* Review comments
* Address PR review feedback
- TaskArtifactPullData: add optional 'number' field separate from db id
- Add ListTaskEventsOptions for event-specific pagination/filters
- Relax sendFollowUp success check (only undefined is failure)
- Drop unused _configurationService field; read config locally in ctor
- Document that cloudAgentBackend.version requires reload
Also turns the client side setting on by default. This setting is controlled by an experiment so it's already 100% enabled for individual users on recent VS Code version. For enterprise, the companies are controlling the rollout through a policy
* Expand extended cache TTL model list + add message-breakpoint sub-toggle
Two related changes to Anthropic Messages API prompt caching:
1. Expand modelSupportsExtendedCacheTtl beyond just the 1M context
variants. Per Anthropic docs, the 1h cache TTL is available on all
active models; this widens our opt-in list to Claude Opus 4.5/4.6/4.7
and Sonnet 4.5/4.6 (all variants, not just -1m).
2. Add a new experiment-based setting
chat.anthropic.promptCaching.extendedTtlMessages as a strict
sub-toggle of the existing extendedTtl setting. When both are on, the
rolling message-level breakpoints (last cacheable user / tool-result
blocks set by addMessagesApiCacheControl) also use the 1h TTL
instead of the default 5m. Nested rather than orthogonal because
Anthropic requires longer-TTL breakpoints to appear before shorter
ones in the tools->system->messages prefix order.
Tests: 69 passed. Added a suite for isExtendedCacheTtlMessagesEnabled
(parent on/off x sub on/off matrix + inherited model/location/subagent
gates) and two tests verifying addMessagesApiCacheControl propagates
the new cacheTtl argument.
* Slim down extended cache TTL tests
- Trim isExtendedCacheTtlEnabled model-list test to just verify the
delegation (full boundaries are covered by modelSupportsExtendedCacheTtl).
- Remove redundant 'inherits gates from parent' test in
isExtendedCacheTtlMessagesEnabled suite — the parent×sub matrix plus
the parent's own gate tests already cover this.
- Merge the two addMessagesApiCacheControl ttl tests into one
parameterized assertion.
* Update stale comment about message breakpoint TTL
The comment claimed message breakpoints 'always use the default 5m TTL',
but that's no longer true when the new extendedTtlMessages sub-toggle is on.
* Refactor extended cache TTL: pass parentEnabled, drop misleading coercions
- isExtendedCacheTtlMessagesEnabled now takes parentEnabled: boolean
instead of re-running the parent gate. Call site passes the resolved
useExtendedCacheTtl directly, eliminating a duplicate experiment-service
lookup per request. Makes the 'sub-toggle of' relationship literal in
the signature.
- Drop the !! coercion on getExperimentBasedConfig<boolean> returns —
the generic guarantees T, so the coercion was misleading defensive
noise.
- Narrow cacheTtl param from '5m' | '1h' to just '1h' on both
addToolsAndSystemCacheControl and addMessagesApiCacheControl. Per
Anthropic docs, { type: 'ephemeral' } already defaults to 5m, so '5m'
is never actually emitted on the wire and call sites never passed it.
- Stronger composition test for isExtendedCacheTtlEnabled — replaces
four single-axis tests with one table-driven matrix that exercises
all four gates simultaneously, catching short-circuit refactors.
- Table-driven 2x2 matrix for isExtendedCacheTtlMessagesEnabled.
- Trim user-facing extendedTtlMessages setting description; team-only
rationale (rolling breakpoints, 2x write premium) lives in the JSDoc.
- Update stale comment claiming message breakpoints always use 5m.
* Remove outdated comments about extended cache TTL models
* Freeze customizations-index per conversation to stabilize system prompt cache
Adds the experimental `github.copilot.chat.freezeCustomizationsIndex`
setting (advanced/experimental/onExp, default false). When on, the
bundled <instructions>/<skills>/<agents> listing in the system prompt is
snapshotted on the first turn and reused on every subsequent turn,
preventing per-turn churn (mode swap rewriting the active subagent in
<agents>, async experimentation flipping a when-gated skill in or out)
from invalidating the system prompt cache.
When the live listing drifts from the snapshot, the updated set is
appended to the latest user message inside AgentUserMessage's context
tag — kept inside the captured RenderedUserMessageMetadata so the
historical user message replays byte-identically on later turns. Drift
also fires with an empty value when the live variable disappears, so
the model gets a signal that previously-listed entries are gone.
Fixes#315408Fixes#316182
* 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>
* Claude agent: add auto permission mode + non-streaming passthrough
- Adds 'auto' permission mode (model-classifier) to Claude sessions, gated
by new setting github.copilot.chat.claudeAgent.allowAutoPermissions
(default true).
- Threads allowAutoPermissions through ClaudeSessionOptionBuilder and the
reactive options pipeline in ClaudeChatSessionContentProvider.
- ClaudeLanguageModelServer: defer response headers until upstream content-type
is known and propagate the SDK's stream flag via requestOptions, so the
classifier's non-streaming (application/json) calls used by 'auto' mode
pass through correctly alongside the existing SSE path.
* add non-streaming passthrough response handling in ClaudeLanguageModelServer
* Claude auto mode: mark setting preview, link aka.ms, honor preview features policy
- Move github.copilot.chat.claudeAgent.allowAutoPermissions into the 'preview' config section and tag it with 'preview'.
- Description now links to https://aka.ms/vscode-claude-auto-mode.
- Auto mode is gated on copilotToken.isEditorPreviewFeaturesEnabled() in addition to the setting, so org-level preview-features policy disables it.
* Claude auto mode: default false, ExperimentBased + onExp tag
- Default off; flipped via experiment.
- Setting tagged with both 'preview' and 'onExp'.
- ConfigKey.ClaudeAgentAllowAutoPermissions is now ExperimentBased; option builder and content provider read it via getExperimentBasedConfig with the injected IExperimentationService.
* Claude auto mode: default to true in the agents window
* Revert "Claude auto mode: default to true in the agents window"
This reverts commit 9083b1c2fd.
* Sessions/Claude: add 'Auto' permission mode item to picker
* Sessions/Claude: gate Auto permission mode item on allowAutoPermissions setting
* Sessions/Claude: also gate Auto on chat entitlement preview features
* Sessions/Claude: use observableConfigValue for allowAutoPermissions
* Sessions/Claude: append Auto mode when enabled instead of filtering
* Sessions/Claude: stub IConfigurationService and IChatEntitlementService in picker tests
---------
Co-authored-by: bhavyaus <bhavyau@microsoft.com>
Re-introduces `cache_control.ttl: "1h"` for the Anthropic Messages
API tools + system breakpoints, gated on the main agent conversation
where the 2x cache-write cost trades favourably against the longer
hit window. Previously reverted from the copilot-chat repo.
All four gates must hold:
- Model is a 1M-context Claude variant (`claude-opus-4-{6,7}-1m...`)
- Setting `github.copilot.chat.anthropic.promptCaching.extendedTtl` is
on (ConfigType.ExperimentBased, default false, advanced/experimental/onExp)
- Location is `ChatLocation.Agent` (Panel/Editor/Terminal/Notebook/
EditingSession/Other and both proxy locations are excluded)
- Request is not a subagent (typed via
`interactionTypeOverride === 'conversation-subagent'`, the same
source of truth as the `X-Interaction-Type` wire header)
When all gates pass:
- The `extended-cache-ttl-2025-04-11` beta header is added
- The last non-deferred tool and the last system block carry
`cache_control: { type: 'ephemeral', ttl: '1h' }`. The two rolling
message breakpoints keep the default 5m TTL, satisfying Anthropic's
longer-TTLs-before-shorter ordering rule.
Tests: messagesApi.spec.ts now at 65 tests (was 59); adds dedicated
`modelSupportsExtendedCacheTtl` and `isExtendedCacheTtlEnabled`
suites covering every gate explicitly.
Tool search is now always enabled for gpt-5.4/gpt-5.5, matching the
messages API path. Aligns the responses API on the same
endpoint.supportsToolSearch capability flag.
Also registers ToolSearchTool for gpt-5.4/gpt-5.5 and the
claude-opus-4.7 variants so model-specific tool gating actually
matches the supported endpoints.
Memory tool is now always enabled. Removes the preview gate, the config
key, the now-unused DI params on MemoryTool/MemoryContextPrompt/
MemoryInstructionsPrompt, and isAnthropicMemoryToolEnabled (replaced by
modelSupportsMemory at the BYOK call site).
Strip Copilot Memory (CAPI) feature entirely
Removes the CAPI-backed Copilot Memory that synced repository-scoped facts
to GitHub. The local file-based MemoryTool with user/session/repo scopes
remains as the sole memory mechanism.
- Delete AgentMemoryService and its test.
- Remove the github.copilot.chat.copilotMemory.enabled setting and its NLS string.
- Remove ConfigKey.CopilotMemoryEnabled.
- Strip all CAPI gating in memoryTool.tsx, memoryContextPrompt.tsx, tools.ts.
- Drop _dispatchRepoCAPI / _repoCreate / _sendRepoTelemetry.
- /memories/repo/ now always routes to local storage.
- Update memoryTool.spec.tsx: remove mock CAPI services and CAPI-only tests.
- Update simulationExtHostToolsService.ts for the new ToolsContribution arity.
* refactor: enhance cache control logic for tools and system prefixes
* refactor: enhance summarization and cache control handling in agent prompts
* refactor: remove unused countCacheControl function from messagesApi tests
* Add tests for summarization and cache control features
- Introduced a new snapshot test for summarization without cache breakpoints in `agentPrompt.spec.tsx`.
- Added a new test suite for `clearAllCacheControl` in `messagesApi.spec.ts` to validate cache control stripping and limits.
- Created a snapshot for summarization without cache breakpoints in the new snapshot file.
* test: pass enableSummarization in summarization.spec helper
The agentPrompt prop split decoupled enableSummarization from
enableCacheBreakpoints, so summarization.spec.tsx — which only set
enableCacheBreakpoints — fell through to the non-summarized branch
and broke 5 snapshot tests. Default the helper's baseProps to
enableSummarization: true so each test exercises the summarized path
as intended; individual tests can still override via otherProps.