* Hide 'View Extension' hover action for core chat agents
Core agents (e.g. the agent host) register with a placeholder
extension id and have no real extension to view. Skip adding the
'View Extension' hover action when the agent has isCore: true.
Fixes#311510
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix TDZ in getChatAgentHoverOptions, defer agent lookup
Some callers construct the hover options before the surrounding
template variable is initialized, so resolving the agent eagerly
hits a TDZ. Make 'actions' a lazy getter so the agent is only
read when the hover is actually shown.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Reuse PermissionPickerActionItem for agent host auto-approve picker
Previously the agent host had its own custom auto-approve picker that
duplicated most of the workbench PermissionPickerActionItem widget. This
refactor reuses the workbench widget when the active session's
autoApprove session-config property uses the well-known schema (string
type, enum subset of {default, autoApprove, autopilot} containing
'default'). Sessions that match get the workbench widget; non-conforming
agents fall back to the existing generic per-property picker.
- Adds AgentHostPermissionPickerDelegate and a thin
AgentHostPermissionPickerActionItem subclass that toggles its
visibility reactively as the active session changes.
- Generalizes the warning/info color rules in chat.css so they live
with the widget rather than being scoped to .chat-secondary-toolbar.
- Groups all agent-host-only files under
src/vs/sessions/contrib/chat/browser/agentHost/.
- Fixes a regression where the picker would stay hidden after
navigating back to the new-chat view; the IActionViewItemService
factory only runs once per render, so visibility must be reactive
rather than gated at construction.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor: agent host reuses PermissionPicker (sessions) instead of PermissionPickerActionItem (workbench)
Both pickers now render in the same context (new-chat-page action bar), so
the previously-needed CSS specificity overrides (icon/font sizing,
padding, color rule un-scoping in chat.css) all go away.
Changes:
- Add IPermissionPickerDelegate to permissionPicker.ts: optional
currentLevel observable, optional isApplicable observable, setLevel.
- Refactor PermissionPicker to take a delegate. When currentLevel is
provided, the picker label tracks it reactively. When isApplicable is
provided, the picker hides itself when false.
- Add CopilotPermissionPickerDelegate (writes through to the active
CopilotChatSessionsProvider session). Preserves today's behavior.
- Move AgentHostPermissionPickerDelegate to its own file under
agentHost/, retargeted at the new interface (currentLevel,
isApplicable, setLevel).
- agentHostSessionConfigPicker.ts now constructs PermissionPicker with
the agent host delegate and wraps in PickerActionViewItem.
- Delete agentHostPermissionPickerActionItem.ts (the workbench widget
subclass) and its CSS overrides.
- Revert chat.css warning/info color un-scoping (no longer needed since
agent host doesn't use the workbench widget anymore).
- Rename the test file to match the new product file. Tests cover the
delegate's permission-level mapping, isApplicable reactivity, and
isWellKnownAutoApproveSchema.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Use PermissionPickerActionItem for ChatInputSecondary, PermissionPicker for NewSessionControl
Restore the contextual split: agent host now uses each widget where it's
expected to render. The new-chat page (NewSessionControl) keeps the
sessions PermissionPicker (matches surrounding sessions pickers); the
running chat widget (ChatInputSecondary) uses the workbench
PermissionPickerActionItem (matches the rest of the chat-input
secondary toolbar that the extension-host CLI already uses).
Both share AgentHostPermissionPickerDelegate. To make the same delegate
satisfy both consumers, rename its members to
currentPermissionLevel/setPermissionLevel (matching the workbench's
IPermissionPickerDelegate).
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Consolidate duplicate AUTO_APPROVE_PROPERTY constant
Both `agentHostPermissionPickerDelegate.ts` and
`agentHostSessionConfigPicker.ts` had identical `'autoApprove'` string
constants (one called `AUTO_APPROVE_SESSION_CONFIG_PROPERTY`, the other
`AUTO_APPROVE_PROPERTY`). Standardize on the shorter name and import it
in the picker. Also drops a now-unused `KNOWN_AUTO_APPROVE_VALUES` set
that was left behind in the picker file. (Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address Copilot review comments
- Dispose `onDidChangeProviders` Emitter in delegate test setup so the
suite-level leak detector is happy. Refactor `setup()` to take the
leak-tracking store and register all created disposables itself, so
individual tests don't repeat the boilerplate.
- Fix corrupted JSDoc on `CopilotPermissionPickerDelegate` (sentence
was mangled across an inline-code span). (Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Drop redundant `_slot` field from PermissionPicker
The `slot` local in `render()` is in scope for the `autorun` closures, so
storing it on `this` is unnecessary. Removing the field also drops the
needless null-check inside the visibility autorun. (Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Allow cherry-pick bot PRs in engineering system changes check
Add an exception for PRs created by vs-code-engineering[bot] whose title
starts with [cherry-pick] and that carry the cherry-pick-artifact label.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fetch cherry-pick-artifact label via API at runtime
The label is applied ~2s after PR creation, so the webhook payload may
not include it. Fetch current labels from the API instead, gated behind
cheap event-payload checks to avoid extra API calls on unrelated PRs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add label retry loop and consolidate guard expressions
Retry the cherry-pick-artifact label check up to 3 times (2s apart) to
handle the ~2s delay between PR creation and label application.
Consolidate the repeated exception guards into a single 'allowed' step
with a 'blocked' output, simplifying downstream conditions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add userDescription and toolReferenceName to tool_search registration
so it passes the canBeReferencedInPrompt check
- Localize displayName and userDescription with l10n.t()
- Group tool under the 'vscode' toolset
- Remove redundant allowTools gate in agentIntent (already gated by
models filter on registration and endpoint.supportsToolSearch)
Leverage the global back arrow button (left of search) to handle
browse-mode exit instead of showing separate 'Back to installed
servers/plugins' links inside each widget.
- Parameterize createBackArrowButton with optional click handler
- For MCP/Plugin sections, exit browse mode on click when active
- Remove backLink DOM element, listeners, and layout accounting
- Remove .mcp-back-link CSS styles
- Add public isInBrowseMode()/exitBrowseMode() to both widgets
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refine the title-generation prompt to prefer sentence case and more compact 3-6 word summaries for chat sessions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Await pending session DB writes on agent host shutdown
The agent host server's SIGTERM/SIGINT handler called process.exit(0)
synchronously, abandoning any fire-and-forget SQLite writes that were
in flight (configValues, customTitle, isRead/isDone, diffs). Under CI
load this caused the 'Session Config persistence across restarts'
integration test to the most recent SessionConfigChanged writeflake
could lose the race against shutdown, leaving the previous value
persisted instead.
Track in-flight writes inside SessionDatabase via a _pendingWrites set
populated by every public mutating method (the outermost wrap is
required so the await this._ensureDb() window is also covered).
SessionDataService aggregates whenIdle() across all live per-session
DBs. The server's shutdown handler now awaits this with a 3s
raceTimeout before disposing.
Removes the await timeout(500) hack the test previously needed.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address PR review: close ws server first, simplify whenIdle loop
- Close the WebSocket server before awaiting whenIdle() so no further
actions can be dispatched during the flush window.
- Simplify SessionDataService.whenIdle(): per-DB whenIdle() already
drains writes against existing DBs, so the outer loop only needs to
re-pass when a NEW DB was opened during the await. Comment now
matches the code.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix Windows: trigger graceful shutdown via stdin close in test
On Windows, child.kill() (SIGTERM) terminates the process unconditionally
without invoking the SIGTERM so the in-flight setMetadata writehandler
never reaches SQLite and the second phase sees no persisted config at all.
Closing the child's stdin fires process.stdin.on('end', shutdown) on every
platform, exercising the same graceful flush path.
(Written by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* nes: show how insertion at cursor leaves an unnecessary newline after the suggestion
Co-authored-by: Copilot <copilot@github.com>
* nes: fix: do not insert spurious trailing newline after suggestion
Co-authored-by: Copilot <copilot@github.com>
* account for CRLF
Co-authored-by: Copilot <copilot@github.com>
---------
Co-authored-by: Copilot <copilot@github.com>
sessions: animate active sidebar chat icons
Render the existing spinning loading icon for in-progress sessions in the sidebar list so active chats match the rest of the sessions app.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Starts working through some basic repo wide eslint rules for the copilot extension. Stuff like missing semicolons and missing readonly modifiers for disposables
* Add 'Don't show again' to autopilot/bypass approvals warning dialogs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add developer command to reset chat permission warning dialogs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Always show AutoApprove warning independently of Autopilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract permission storage keys to shared constants module
Move AUTOPILOT_DONT_SHOW_AGAIN_KEY and AUTO_APPROVE_DONT_SHOW_AGAIN_KEY
to chat/common/chatPermissionStorageKeys.ts so both chatDeveloperActions
and permissionPickerActionItem import from a lightweight shared module.
This avoids chatDeveloperActions pulling in heavy widget/UI dependencies
at startup via the permissionPickerActionItem import.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nes: consolidate speculative request cancellation
Introduces SpeculativeRequestManager that owns the lifecycle of NES
speculative requests (the in-flight 'pending' bet on a post-accept
document state, plus the 'scheduled' speculative deferred until its
originating stream completes). All cancellation now goes through one
path with a typed SpeculativeCancelReason logged on the request's
log context, and pairs cancel() with dispose() on the token source
to release listeners.
Adds these cancellation triggers that previously leaked the speculative:
- CacheCleared: clearCache() now cancels in-flight speculatives — they
would otherwise land into a cache that was meant to be empty.
- DocumentClosed: when a doc is removed from openDocuments, any
speculative targeting it is cancelled — its cached result could
never be hit again.
- Disposed: provider dispose now cancels all speculatives.
Also removes the special-case in handleIgnored for the superseded
branch — the trajectory check on the document change that caused the
supersede is the authoritative signal.