Fixes#311734
Set COPILOT_AGENT=1 in agent terminal sessions so CLI tools can
detect they are running inside an AI agent and adapt their output
(e.g. JSON instead of ANSI, disable interactive prompts, skip
animations). This follows the same pattern as other agents
(CLAUDE_CODE, CURSOR_AGENT, etc.).
Co-authored-by: Megan Rogge <meganrogge@Megans-MacBook-Pro.local>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The pages array excludes page 0 (pre-resolved via firstPage), so
accessing this.pages[pageIndex] is off by one — pageIndex 1 should
map to pages[0]. This caused 'Cannot read properties of undefined
(reading promise)' when resolving extensions on any page after the
first.
Co-authored-by: vs-code-engineering[bot] <122617954+vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* AgentCustomizationItemProvider for both local and remote
* update
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* update
* only sync plugin & extension customizations
* fix tests
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Replace the eslint-disabled import of LOCAL_SESSION_ENABLED_SETTING from
the providers layer with ISessionsManagementService.getAllSessionTypes().
The local harness is now registered when any provider offers a session
type with id 'local', and removed when it disappears.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the spread-based `IActiveSession` construction with an
`ActiveSession` class that delegates all `ISession` property accesses
to the underlying session object. This keeps the active session in sync
with live session state instead of holding a stale shallow copy.
When a session is replaced via `onDidReplaceSession`, pass
`force: true` to `setActiveSession` so the active session is always
fully rebuilt — even when the session ID remains the same.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move copilotChatSessions, remoteAgentHost, and agentHost providers from
contrib/ into a new contrib/providers/ subfolder for clearer separation
- Add ESLint layer rule 'contrib/providers/*/~' (before 'contrib/*/~') so
sibling contrib folders cannot import directly from providers
- Update all entry points (sessions.common.main.ts, sessions.desktop.main.ts,
sessions.web.main.ts) to reference new provider paths
- Port all upstream changes from origin/main to the new provider locations
- Add contrib/providers entry to build/lib/i18n.resources.json
- Rewrite docs: README.md, LAYOUT.md, LAYERS.md, SESSIONS.md, SKILL.md,
sessions.instructions.md; add source-code-organization, coding-guidelines,
and writing-tests instruction files; remove stale SESSIONS_PROVIDER.md and
AGENTS_CHAT_WIDGET.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* 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.
After Windows smoke tests finish, Electron child processes (ptyHost,
sharedProcess, network-shared, etc.) can outlive the main process and
keep .build/logs/smoke-tests-electron/*/main.log and friends locked.
That makes the 1ES auto-injected 'Publish Log Files' output fail when
it tries to hash those files (~2 minutes later), failing the whole
Windows Electron Tests job even though all tests passed.
Add a defensive cleanup step right after PublishTestResults that
force-kills any process whose executable lives under the test build
directory, so the publish step has unlocked files to hash.
Refs flaky-test occurrence in build 438755 attempt #1.
* build: bump @vscode/gulp-electron to 1.41.3
Brings in microsoft/vscode-gulp-electron#42 which adds retry-with-backoff
around transient network errors when downloading Electron, fixing build
breaks like getaddrinfo ENOTFOUND release-assets.githubusercontent.com.
NOTE: package-lock.json will be regenerated once 1.41.3 is published.
Do not merge until then.
* Sync package-lock.json with package.json after updating @vscode/gulp-electron to 1.41.3.