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>
* fix: guard postToolUse hook against closed response stream (fixes#319003)
When the user cancels a chat request while tools are executing, the
response stream is closed. The postToolUse hook would then attempt to
write warnings via hookProgress to the closed stream, causing an
unhandled 'Response stream has been closed' error.
Add a cancellation token check before executing the postToolUse hook.
If the request is already cancelled, skip the hook entirely since the
stream cannot accept further output.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: replace unicode em-dash with ASCII hyphen in comment
The Compile & Hygiene check failed due to a non-ASCII character (U+2014
em-dash) in a code comment. Replace with a standard hyphen.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: vs-code-engineering[bot] <122617954+vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bring over the latest version of the protocol
* Phase 1 & Phase 2
* Phase 3
* Phase 4
* Phase 5
* Fix diff information in the sessions list
* Wire-up the resolving the changesets when the session is active
* More fixes following the branch
* Attach the changesets for a materialized session
* Manually fix agent host protocol file
* 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>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Fix compilation errors
* Skip/fix some tests
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Kill full server process tree in agent host kill_running_server
The CLI agent host supervisor launches the server via a shell shim
(`<server>/bin/code-server-<quality>`) that spawns `node ... server-main.js`,
which in turn spawns a `bootstrap-fork` agent host process. The previous
`child.kill()` in `kill_running_server` only terminated the shim, leaving
the node descendants reparented to PID 1.
Route the shutdown through `kill_tree` instead, and have the non-Windows
`kill_tree` walk the full descendant tree via `pgrep -P` rather than just
the direct children. Add a depth-3 process-tree unit test on Unix.
Fixes#319516
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix flaky kill_tree test by reaping spawned child process
The previous test relied on `process_exists` to confirm pids were gone,
but on Linux the outer sh remains a zombie until its parent (the test
runtime) reaps it. Await `child.wait()` immediately after `kill_tree`
so the outer sh is reaped, and rely on init to reap the orphaned
descendants. Also bumps the deadline to 10s to absorb init latency.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Bound kill_running_server wait and check pgrep exit status
Addresses Copilot review feedback:
- kill_running_server: bound child reap with a 5s timeout; escalate to
SIGKILL via Child::kill if a process ignores SIGTERM, so a misbehaving
server can't wedge the supervisor's shutdown or upgrade path.
- children_of: distinguish pgrep exit codes — 0/1 are expected (matches
vs no matches), 2/3 are surfaced as CommandFailed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: refresh static changesets after git state
Use runtime git metadata as a fallback for Branch Changes when the persisted diff base is absent, refresh Branch and Uncommitted changesets after git state attaches, and mark cached static changesets as computing during background refreshes.\n\nScope temp-index git staging to changed pathspecs so nested repos and large checkouts do not require full-tree staging.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: add changeset refresh debug logs
Add low-noise debug logging for git-state-triggered static refreshes, Branch Changes base-branch fallback, preserved cached uncommitted snapshots, and scoped temp-index staging counts.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: preserve git failure contracts
Keep temp-index git failures on the existing undefined-return path instead of throwing through changeset and checkpoint callers.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: remove temp-index timeout changes
Keep temp-index git operations on the same timeout behavior they had before the scoped pathspec change.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: avoid eager status path parsing
Only parse the full changed path list when temp-index diffing is needed for untracked files.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chat-lib release: add 'auto' option to pick version from copilot's package.json
Adds an 'auto' choice to the nextVersion parameter that publishes
whatever version is already in chat-lib/package.json (which
build-chat-lib.yml syncs from extensions/copilot/package.json),
so releasers no longer have to type the version manually.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The sessions list capped each workspace group at a hardcoded 5 sessions before showing the 'show more' affordance. Make this configurable via an IWorkbenchAssignmentService treatment ('sessions.workspaceGroupLimit'), defaulting to 5 when unset or invalid. The resolved value is encapsulated in an observable so rendering code reads it synchronously without spreading promises, and it is refreshed whenever the assignment service refetches treatments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor chat component styles to use CSS variables for font sizes and update chevron icons to compact versions
Co-authored-by: mrleemurray <mrleemurray@users.noreply.github.com>
Co-authored-by: Copilot <copilot@github.com>
Add an A/B experiment that moves the session type (harness) picker from next to the workspace picker down into the bottom input controls (dropping the 'with' connector label).
The SessionsPart resolves the 'agentSessionsHarnessPickerInControls' treatment via IWorkbenchAssignmentService and tracks it (re-reading on onDidRefetchAssignments) in an observable. The value is threaded down through IChatViewOptions to the new-chat views, which snapshot it once at creation time so placement stays stable for the view's lifetime.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agent-host: complete the turn when `/compact` finishes
`/compact` in AHP Copilot sessions short-circuited `send()` by calling
`rpc.history.compact()` and returning early without driving an SDK turn.
Turn completion is only emitted from the SDK's `onIdle` event, so the
turn opened by the server was never closed and the UI spun "working
forever" (#320152).
Mirror the generic `/rename` handling: after the compact RPC resolves,
emit a brief acknowledgement response and complete the active turn so
the session returns to idle. This routes through the same
`_runTurnCompleteSideEffects` path as normal `onIdle` completion, so
queued-message draining and turn telemetry are unaffected. The error
path is unchanged (re-throws → `SessionError` ends the turn).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agent-host: emit `/compact` acknowledgement and assert no SDK send
Address Copilot review on #320544:
- Emit the acknowledgement `SessionResponsePart` before completing the
turn (the previous commit assigned `success` but never used it, which
also left it unused for `noUnusedLocals`). This restores the
`/rename`-style inline acknowledgement.
- Assert the failed-compaction test does not fall through to
`session.send()`.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agent-host: don't emit response content for `/compact`
Per review feedback, `/compact` should silently complete its turn rather
than emitting a markdown acknowledgement into the session transcript. The
compact RPC result is no longer inspected; the turn is completed inline so
the session returns to idle. Tests updated to assert no SessionResponsePart
is emitted.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: update @github/copilot to version 1.0.60 in package.json and package-lock.json
* chore: update @github/copilot to version 1.0.60 in package.json and package-lock.json
* test: update feature flag service creation in Copilot CLI tests
* Add tooltips to agent host session config pickers
The agent host session config dropdowns (Approvals, Mode, Branch,
Worktree, etc.) set an aria-label but never wired up a hover tooltip,
even though the underlying schemas already carry descriptions. Hook the
schema description (falling back to title) up as a delayed hover on each
picker trigger.
Fixes#319820
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix hover leak on permission picker re-render
renderLabel can run against a fresh element on subsequent render()
calls (e.g. moving into/out of overflow). Track the current element and
re-wire the delayed hover via a MutableDisposable so the old
registration is disposed and new elements still get a tooltip.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>