Map SDK assistant.intent events to AHP session activity now that report_intent has been removed. Preserve clearing on empty intents and when the session becomes idle.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* AgentHost - nicer display messages for the feedback comment tools
The feedback comment server tools (addComment, listComments, deleteComments,
resolveComments, viewUnreviewedComments) had no special handling in the Copilot
agent host display layer, so they fell through to the generic
`Using/Used "<toolName>"` fallback.
Add dedicated invocation and past-tense messages for these tools in
copilotToolDisplay.ts. listComments reports the number of comments parsed from
the tool result (e.g. "Checked 3 comments"), falling back to "Checked comments"
when the result is missing or malformed. The result text is threaded through
getPastTenseMessage from both the live (copilotAgentSession) and history-replay
(mapSessionEvents) paths so the message is identical on reload.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* AgentHost - hoist server-tool display into the owning group
The feedback comment tools (addComment, listComments, deleteComments,
resolveComments, viewUnreviewedComments) are one provider-agnostic server-tool
group, but their display strings were authored per-provider, so only Copilot
rendered them nicely; Claude showed `Used "listComments"` and Codex showed
`Called listComments`.
Add a generic, optional `getDisplay(toolName, args, result?)` to
`IServerToolGroup` and let `feedbackServerToolGroup` implement it once
(including the listComments "Checked N comments" count). A new pure
`getServerToolDisplay` dispatcher in `serverToolGroups.ts` matches a tool by
bare name or transport-prefixed form (Claude's `mcp__host__<name>`), so each
provider's display layer (copilotToolDisplay, claudeToolDisplay,
codexMapAppServerEvents) consults it first and falls back to its generic
message otherwise. `serverToolGroups` is now the single source of truth wired
into AgentServerToolHost.
Comment-tool display strings move out of copilotToolDisplay.ts; exhaustive
coverage moves to serverToolGroups.test.ts with a delegation smoke check left
in copilotToolDisplay.test.ts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* AgentHost - address Copilot review feedback
- Codex: pass the tool call's real arguments (params.item.arguments) to
getServerToolDisplay at completion instead of undefined, matching the start
branch and enabling args-dependent past-tense messages.
- Test: drop the unused `count` parameter from the listComments past-tense
helper; the result text fully determines the expected message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* smoke: write remote server exit diagnostics to a file
The server exit diagnostics added in #322697 logged via `console.error` to
stderr, which on Windows is piped through the test resolver and a cmd.exe
batch wrapper. A process `exit` handler cannot flush that async pipe write
before the process dies, so the exit-time lines we care about most were
dropped: build 451044 captured 24 `installed` lines but zero `exit` /
`beforeExit` / signal lines.
Write the diagnostics synchronously with `fs.appendFileSync` into a
`server-exit-diagnostics.log` file under the server's `--logsPath` (captured
as a smoke artifact) so they survive teardown, while still mirroring to
stderr for live visibility. Remains gated behind VSCODE_SERVER_EXIT_DIAGNOSTICS
so the shipped product is unaffected.
Co-authored-by: Copilot <223556219+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>
* smoke: prevent server exit diagnostics from looping on EPIPE
The first CI run with these diagnostics (PR #323278) reproduced the remote
server crash and the new `server-exit-diagnostics.log` file captured the
trigger: an unhandled `EPIPE` from a `console.warn`/`console.error` stdio
write after the host-proxy pipe closed (here, the node.js file watcher's
'watched path got deleted' warning). Node promotes that EPIPE to an uncaught
exception, which crashes the server.
But the diagnostics also mirrored each line to `console.error`, so logging
the EPIPE exception from inside the `uncaughtExceptionMonitor` handler wrote
to the same broken pipe, threw EPIPE again, and re-entered the handler —
515k iterations producing a 386MB log file in one run.
Fix: write diagnostics only to the file (never to stdout/stderr, the channel
under investigation), and add a re-entrancy guard on the uncaught-exception
handler so a logging failure can never recurse.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* smoke: restore a safe stderr mirror for exit diagnostics
Addresses PR review: the description states each diagnostic line is mirrored
to stderr for live visibility, but the previous fix dropped the mirror
entirely to break the EPIPE loop. Reintroduce the mirror in a crash-safe way
instead: keep the synchronous file write as authoritative, and additionally
write to stderr only while a `mirrorToStderr` latch is set. The latch is
turned off on the first synchronous write failure, and an `error` handler on
`process.stderr` swallows async pipe errors, so a broken pipe during teardown
can never throw (and re-enter `uncaughtExceptionMonitor`) again.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Agent host: add CPU profiling command (Written by Copilot)
Add start and stop developer commands that profile the local Agent Host, save the resulting cpuprofile, and open it in the built-in profile viewer. Support both the regular workbench status bar and the Agents window notification flow.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Agent host: sanitize saved CPU profiles (Written by Copilot)
Rewrite absolute call-frame paths and append a text suffix in built products before saving Agent Host CPU profiles.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
terminal: route session navigation keybindings to workbench
Ensure Agents window session navigation commands are handled by VS Code when the integrated terminal has focus, with regression coverage for the default skip-shell list. (Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add chat quota trajectory nudge
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Limit chat input notification CSS changes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Dismiss quota trajectory nudge on action
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trim redundant quota trajectory test
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update quota trajectory notification link
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Align quota trajectory nudge requirements
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Exclude Edu from quota trajectory nudge
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Instrument quota trajectory nudge telemetry
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Include Max in quota trajectory nudge
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address quota nudge review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Integrate quota trajectory notification levels
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Gate quota nudge experiment by locale
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Simplify quota nudge locale guard
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove quota nudge notification kind
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address quota nudge PR comments
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trim quota nudge to essential lines
Remove redundant trajectory-shown signature dedup, duplicate storeTrajectoryShown calls, the redundant terminal baseline capture, dead canUpgradePlan test scaffolding, and cosmetic churn. Inline the single-use link-click handler.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Enroll quota trajectory experiment just-in-time
Defer the getTreatment exposure until the user has met every condition
required to render the nudge, so treatment and control cohorts are
assigned at the same point and users who would never see the nudge are
not enrolled. Moves the locale check into candidate computation and
removes the eager-enrollment gate, restoring the original update flow.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Consolidate trajectory enrollment into warning computation
Move the just-in-time experiment enrollment into
_computeQuotaTrajectoryWarning so _update stays lean. The method
dispatches the async assignment once every render condition is met and
returns a warning only for the treatment cohort; while assignment is
pending it returns undefined and the remainder of _update falls through.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restoring comment
* Do not treat unassigned trajectory treatment as control
getTreatment returns undefined when the user is not in the experiment
flight (or assignments are unavailable), which is distinct from being
assigned to a control cohort. Store the raw treatment value and render
the nudge only on an explicit 'enabled' value, instead of coercing a
missing assignment into a synthetic 'control' enrollment.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Emit enrollment telemetry only when assigned to the experiment flight
Log a chatQuotaTrajectoryNudgeEnrolled event with the resolved treatment
value when the experiment service assigns the user to a flight (treatment
is defined), to measure experiment exposure across both arms. No
telemetry is emitted when TAS returns no assignment.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use config.-prefixed boolean treatment key for quota trajectory nudge experiment
ExP for VS Code requires experiment treatment keys to be prefixed with
config. The treatment is a simple yes/no, so use a boolean type instead
of a string.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Align quota nudge telemetry with generic notification telemetry
Remove trajectory nudge shown and dismissed interaction telemetry now that
generic chat input notification telemetry covers those interactions. Keep the
learn more link click event because it is specific to this nudge.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address quota trajectory nudge review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove active trajectory telemetry state
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor
* Retry CI after smoke test crash
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove quota trajectory locale gate
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address quota trajectory review comments
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update quota trajectory nudge copy
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Avoid extra chat model lookup helper
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Capitalize standalone quota trajectory link
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add period to quota trajectory nudge copy
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move quota trajectory SKU targeting to experiment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Migrate quota nudge to Copilot experiment config
Resolve the quota trajectory nudge through the Copilot extension's experiment-based configuration service so SKU targeting remains in ExP and workbench avoids importing extension code directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Avoid blocking quota experiment command activation
Register Copilot contributions before waiting for experimentation so the workbench command bridge can activate promptly. Bound the quota experiment treatment wait so transient experimentation initialization failures retry instead of hanging the workbench command indefinitely.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert "Avoid blocking quota experiment command activation"
This reverts commit 6a3a1271aa.
* Register quota experiment command before treatment wait
Register the quota trajectory experiment bridge command before the Copilot extension waits for initial experiment treatments, so workbench callers do not silently miss enrollment while Copilot contributions are still blocked. Keep the command implementation shared with the context key contribution path.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Copilot command bridge CI failures
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Allow hidden quota trajectory experiment setting
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Generalize hidden advanced config validation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rerun PR checks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rerun PR checks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use workbench assignment for quota nudge
Resolve the quota trajectory treatment directly through the workbench assignment service and remove the Copilot extension command/config bridge.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Revert unused config test workaround
Remove the package.json configuration test workaround now that the quota trajectory experiment no longer uses a Copilot setting.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Restore isPublic-based advanced config test generalization
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* no-mistakes(document): document IChatInputNotification.telemetryId field
* no-mistakes(review): fix quota telemetry: threshold, linkToAuto, trajectoryNudge id
* no-mistakes(document): Add doc comment for `canSwitchModelByIdentifier`
* no-mistakes(lint): Fixed missing sinon import in chatQuotaNotification test
* Remove engineering-system changes from quota PR
Restore package files and the Copilot configuration test workaround now that the quota experiment no longer uses a Copilot setting.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address quota trajectory review nits
Route treatment resolution failures through ILogService and simplify the trajectory treatment request path/comment.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove unnecessary notification telemetry comment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Clarify quota trajectory cohort lookup comment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rerun PR checks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Assume Auto is available for quota nudge
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refine quota nudge auto model handling
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Centralize Auto model selection detection and identifier
Revert the chatInputPart.ts additions (Auto is assumed always available) and
move 'is auto selected' into the common chatSelectedModel module as
isSelectedModelAuto, mirroring the sibling isSelectedModelCopilot. Export the
existing AUTO_MODEL_IDENTIFIER from languageModels.ts as the single source of
truth, reused by both the nudge's switch-to-Auto command and the detection
helper.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Make Try Auto link work in Copilot CLI agent-host sessions
The quota trajectory nudge's Try Auto link was hardcoded to the 'copilot/auto' identifier for both detection and switching. In a Copilot CLI agent-host session the Auto model is registered as 'copilotcli:auto' and the general 'copilot/auto' is filtered out of the session's model pool, so the link silently no-opped and 'already Auto' was never detected.
Key Auto off the canonical metadata.id === 'auto' marker instead: add AUTO_MODEL_ID + ILanguageModelChatMetadata.isAutoModel, use it in isSelectedModelAuto, and add a session-aware ChatInputPart.switchToAutoModel() that the nudge calls. Works for both the Copilot panel and the Copilot CLI harness.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Simplify quota trajectory nudge to a single learn-more link
Drop the "switch to Auto" capability and all Auto-model detection from the
quota trajectory nudge. The nudge now shows only a learn-more link to
https://aka.ms/token-usage-tips and logs chatQuotaTrajectoryNudgeLinkClicked
when clicked.
Revert the Auto-detection/switching scaffolding back to its pre-PR state:
- languageModels.ts: remove AUTO_MODEL_ID export, isAutoModel/isAutoModelIdentifier
- chatSelectedModel.ts: remove isSelectedModelAuto
- chatInputPart.ts: remove switchToAutoModel
- languageModels.test.ts: remove the corresponding suites
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sessions: align list navigation bracket shortcuts
Add the macOS bracket shortcuts used by editor navigation to the sessions list previous/next commands while preserving the sessions-only Alt+Up/Down alternates. Update the sessions list spec to document the navigation bindings. (Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: dispose request and toast listeners
Own language model cancellation callbacks and browser toast event listeners so they are cleaned up with their request-scoped disposable stores. Add regression coverage for completed language model requests.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: strengthen cancellation listener test
Cancel the source token after response completion and verify cancellation is no longer forwarded to the extension host.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hold the target peer chat model reference across the first send so ChatService does not reject newly-created subchats as unknown sessions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* NES: cache cross-file suggestions under the active document
When the model returns a Next Edit Suggestion for a document other than
the one being edited (cross-file NES), it was only cached under the target
document, so it could not be re-served until the user navigated there.
Also cache an `activeDoc (content + edit window) -> edit-in-target`
association so the suggestion can be re-served from cache while the cursor
is still in the active document.
A cross-file entry is served only while its target document is open and
byte-identical to the snapshot the edit's offsets index into; otherwise the
read path treats it as a cache miss and refetches, rather than serving a
misplaced edit or getting stuck re-serving a dead entry until the active
document changes. At stream end the active document is no longer cached as
"no edit" when a cross-file entry was just stored under the same key, which
would otherwise clobber it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Dispose provider and documents in runCrossFileScenario
Tear down the NextEditProvider (which registers autoruns/watchers on
openDocuments) and both documents at the end of each cross-file scenario
run so the tests are self-contained and do not accumulate observers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A plain 'npm run export-policy-data' loads dev-profile extensions, injecting
referencedSettings the fixture-based PolicyExport integration test won't
produce — failing CI in a way that is not reproducible locally. Document the
isolated regeneration command.
The checked-in policyData.jsonc was generated with the Copilot extension
loaded, which injected referencedSettings linking the OTel extension
settings to the core CopilotOtel* policies. The PolicyExport integration
test regenerates using the test fixture distro with no user extensions, so
those referencedSettings are absent. Regenerate in an isolated environment
to match the fixture-based export.
Fix client-tool completion routing to resolve providers by parent session while preserving the originating chat channel for provider callbacks.
Update agent host unit and protocol fixtures to dispatch chat actions on explicit AHP chat channels and keep subagent chat state separated from parent sessions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make agent sendMessage receive both the parent session URI and the owning chat URI explicitly. This keeps default-chat sends from being mistaken for base64 session IDs and preserves the strict chat-channel invariant.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Show per-turn file changes summary for agent host chat responses
Render the "Changed N files" summary under completed agent host chat
responses, driven by the per-turn changeset the host computes
server-side (the same source as the Agents window Changes view) rather
than the chat editing session.
- Add IChatResponseFileChangesService, a per-session-type provider
registry the changes-summary content part consults before falling back
to the editing session. The summary part self-hides when the resolved
diffs are empty, so turns with no edits show nothing.
- Add the agent host provider, which subscribes to the session's
per-turn changeset (keyed by the response's turn id) and maps its
files into edit-session diffs.
- Relax the chat list renderer gate so the summary is created for agent
host responses (which emit external edits, not text edit groups).
- Extract a shared FileEdit normalization helper and reuse it across the
external-edit, snapshot, and changeset mappers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix agent host handler tests and address review feedback
- Stub IChatResponseFileChangesService in the agent host chat
contribution and client-tools tests, which instantiate
AgentHostSessionHandler (it now registers a response file changes
provider). This fixes the unit test failures.
- Use isEqual for rename detection in normalizeFileEdit, matching the
prior adapter behavior (case-insensitive paths).
- Use the canonical agent-host-copilot chat session scheme in the
provider test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR feedback by requiring chat actions and tool confirmations to flow on their AHP chat channels. Fix disconnected-client cleanup to iterate chats explicitly, normalize telemetry ids, and unblock subscription hydration on errors.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>