Keep compact/overflow menubar submenus in sync on updateMenu
MenuBar.updateMenu only replaced the top-level menu's actions, but the
compact (hamburger) and "More" overflow menus open their own
SubmenuActions that captured the previous actions array at layout time.
Context-key driven changes (e.g. the File > Auto Save checkmark) were
therefore stale until an unrelated relayout.
Fixes#160894
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sync Workspace Trust scrollbar with native body scrolling
Focus-driven native scrolling of the Workspace Trust editor body (e.g. pressing
Tab into offscreen controls) did not update the DomScrollableElement model, so
the header shadow and scrollbar slider stayed in their top state and wheel-up
was ignored. Rescan the DOM on native scroll events.
Fixes#131746
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AcesShared agents download the default 64 KB chunks of the ~1.5 GB macOS
node_modules archive at ~7 MB/s, with blob request timeouts, so each macOS
job spends ~3.5 min restoring it. Pipeline artifacts with 1 MB chunks reach
~40 MB/s on the same agents. Set the agent's chunk size knobs on the Cache@2
steps so their post-job step saves new entries with 1 MB chunks, and add a
key segment so new entries are created in that format.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: fix side-chat archive cleanup and sandbox routing
Release private folders and changeset watchers when a side chat is archived or excluded.
Route sandbox child-chat archive and restore actions to the owning host, while keeping
parent session archive actions on the inventory path.
Add regression tests for folder ownership, watcher lifecycle, and exact child-chat routing.
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: keep archived descendants detached across restores
Use origin-chain in-use filtering when restoring session folders and when
reattaching an unarchived chat's family. Reconcile only live branch summary
sources when the session's working directories change.
Cover host restarts, both nested restore orders, and archived summary-only
side chats whose private folders are detached.
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The AzureCLI@2 login and secret fetch in 'Setup copilot test environment'
failed main CI twice in 30 days on transient errors (488663: subscription
lookup, 483178: connection reset). npm run setup replaces its .env entries
by key, so retrying the step is safe.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes https://github.com/microsoft/vscode/issues/342170
With `files.autoSave: afterDelay`, typing in the Markdown Editor could
lose keystrokes and make the caret jump: a sentence typed as `it might
be better if` was saved as `it mbe better if`.
## Cause
The Markdown Editor webview applies typing locally and sends each change
to the extension as an edit tagged with an *edit epoch*. The extension
advances the epoch and pushes the document text back into the webview
only when the document changes externally. Edits tagged with an older
epoch are then ignored.
VS Code also fires `onDidChangeTextDocument` when only the dirty state
changes, with empty `contentChanges`: on save, and on the first edit
after a save. The provider handled such an event like an external
change. It advanced the epoch and sent the document text to the webview.
Edits that were still in flight from the webview became stale and were
dropped, and the webview's newer text was replaced by the older document
text. Every auto save therefore caused up to two such
resynchronizations. On large files, where the webview is slow per
keystroke, each one lost several characters.
## Fix
Ignore document change events without content changes in the Markdown
Editor provider. Real external changes, including save participants that
modify text, still resynchronize the webview as before.
## Validation
- New bridge test `keeps accepting edits across saves without
resynchronizing the renderer`: it saves between two edits of the same
epoch. It fails without the fix (second edit dropped, `update` posted)
and passes with it.
- Reproduced in Code OSS on a ~96 KB Markdown file with `files.autoSave:
afterDelay` (1000 ms). Before: characters were missing from the saved
text. After: the full typed sentence was saved.
The typing lag on large files (problem 2 in the issue) is tracked
separately in https://github.com/microsoft/vscode/issues/344635.
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
Fixes#344588.
## Changes
- Immediately queue confirmed worktrees and prevent duplicate
submissions while the batch is being scheduled.
- Keep confirmed-cleaned rows in place while the cleanup editor remains
open instead of removing them and shifting the table. Show **Worktree
removed**, zero storage, and no cleanup checkbox; retain usable session
links. Closing and reopening omits these in-view completion records but
still shows actual leftover worktrees.
- Retain removed/pending/failed/needs-attention batch counts across
refreshes, filter changes, and subsequent cleanup batches.
- Preserve selection, deliberately unchecked worktrees, and session
identity through progress updates. Coalesce progress rendering rather
than rebuilding the table for every scheduling callback.
- Show selected worktree count and estimated reclaimable size together,
for example **Clean Up 3 Worktrees (~1.2 GB)**. Completed/nonselectable
rows do not contribute, and the accessible label spells out the
estimate.
- Continue scheduling after individual failures, keep unresolved
worktrees visible, and offer **Retry Failed Worktrees** for eligible
failures in the current filter without submitting unrelated selections.
- Distinguish unavailable/unsupported storage measurement from confirmed
zero storage. Start the fallback reconciliation timeout after scheduling
finishes and guard late work after the editor closes.
- Use native `WorkbenchTable` widgets with resizable columns, fixed
headers, and bounded, independently scrollable bodies. Recycle cell
templates, keep controls stable, and update numeric storage cells
without rebuilding unrelated metadata when row membership/order is
unchanged. Select All sits above the table; narrow windows scroll
headers and rows horizontally together.
- Keep Select All, counts, estimates, and cleanup submission based on
all matching eligible worktrees, including off-screen rows. Update
keyboard navigation, row accessibility information, progress
announcements, and accessibility help.
**Done/archived does not mean the worktree was removed.** Older archival
Git operations could time out after five seconds, leaving worktrees
behind. These sessions must remain visible and retryable when eligible,
including after reopening; only confirmed removal produces a
nonselectable completed row. Cleanup continues to preserve session
history.
Backend storage caching from #344356 is unchanged and is separate from
these UI changes; it is not present in the reported 1.144 installation.
Where available, valid persisted estimates for unchanged idle worktrees
avoid repeated recursive scans, including after host restart. Active,
changed, or invalidated worktrees still require measurement. This
follow-up virtualizes rendering, not measurement: the service still
publishes full snapshots and the editor still filters/sorts the full
matching set.
**Publication status:** All changes above are committed and pushed in
`ab2f580667042acf330b148dd03cbe41f82a06f5`.
## Testing steps
Use disposable sessions with isolated worktrees only; do not test
deletion on valuable worktrees.
1. Launch the Code OSS Agents window and prepare several disposable
sessions with worktrees, including a Done session whose worktree still
exists.
2. Run **Chat: Open Worktree Cleanup** from the Command Palette. Adjust
the age/workspace filters so the test sessions appear.
3. Leave one row unchecked and select several others. Check that the
action combines the selected worktree count and estimated reclaimable
size. Confirm cleanup: the submitted rows should immediately show queued
state and prevent duplicate submission while scheduling.
4. Watch the results without closing the editor. Confirmed-cleaned rows
should stay in place as **Worktree removed**, show zero storage, and
have no cleanup checkbox. Their session links and history should remain
usable. Remaining checked/unchecked choices and focus should be
preserved; the batch summary should retain all outcomes.
5. Submit another batch and change filters. The summary should remain
batch-wide, while selection and **Retry Failed Worktrees** remain
filter-scoped.
6. Close and reopen cleanup. Prior completed display rows should be
gone, but Done/archived sessions with actual leftover worktrees must
remain available for eligible retries. Unavailable/disconnected
measurement must not appear as successful removal.
7. With a large controlled dataset, scroll each table under its fixed
header, resize columns, and resize the editor. In narrow windows, scroll
horizontally and verify headers remain aligned. Verify rows
render/recycle correctly, focus and checkbox state follow the session,
and Select All/count/size include off-screen matching worktrees. Storage
updates that do not change membership/order should not rebuild unrelated
cells or controls.
8. Use the keyboard and **Alt+F1** to check help, progress
announcements, row information, arrow/Page navigation, Enter to open a
session, and Space to toggle an eligible worktree.
9. Reopen without changing the remaining idle worktrees. Where backend
caching is available, valid estimates should be reused. Storage-check
progress counts cache checks too and is not proof of recursive scanning.
Partial scheduling failure, continued scheduling, failed-measurement
recovery, filter-scoped retry, completed-row retention, and reopening
behavior have deterministic test coverage. A controlled failure fixture
should retain failed rows and retry only eligible failures in the
current filter, not unrelated selections.
## Validation
Validation of the published follow-up:
```bash
# Passed: incremental client build
npm run build-fast -- --client-only
# Passed: full product build outputs verified current before reloading OSS
npm run build-fast
# Passed: 105 cleanup editor/service tests
./scripts/test.sh \
--run src/vs/sessions/contrib/sessionInputBanners/test/browser/sessionWorktreeCleanupEditor.test.ts \
--run src/vs/sessions/contrib/sessionInputBanners/test/browser/sessionWorktreeCleanupService.test.ts \
--reporter dot
# Passed: client typecheck
npm run typecheck-client
# Passed: 23 targeted provider tests
./scripts/test.sh \
--run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts \
--grep 'worktree|advertised identity' \
--reporter dot
# Passed: formatting, lint, CSS and hygiene for all 10 changed files
node build/hygiene.ts \
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts \
src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts \
src/vs/sessions/contrib/sessionInputBanners/browser/media/sessionWorktreeCleanupEditor.css \
src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupEditor.ts \
src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupAccessibilityHelp.ts \
src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupService.ts \
src/vs/sessions/contrib/sessionInputBanners/test/browser/sessionWorktreeCleanupEditor.test.ts \
src/vs/sessions/contrib/sessionInputBanners/test/browser/sessionWorktreeCleanupService.test.ts \
src/vs/sessions/services/sessions/common/sessionsManagement.ts \
src/vs/sessions/services/sessions/common/sessionsProvider.ts
# Passed: whitespace check
git diff --check
```
Regression coverage includes 2,000-row virtualization and full-filter
selection, isolated visible/off-screen storage updates, native column
alignment/resizing and horizontal scrolling, row announcements, Tab
entry, keyboard selection and session activation, focus migration
between groups, and queued/completed accessibility states. The earlier
three native-list test failures are resolved.
The original Compile & Hygiene failure was formatting-related, with PR
Gate failing consequently. The formatting fix is included and local
hygiene passes; the new head still requires CI.
**Live screen-reader and complete manual archive/restore validation are
not claimed as passed.** The isolated OSS Agents window has been
reloaded with current outputs for hands-on testing. Earlier hand-seeded
mock sessions had incomplete restore data. No real worktrees, stale
locks, or session records were modified during diagnosis or validation.
* sessions: add setting to indent sessions list items
Adds the advanced, experiment-controlled `sessions.list.indentItems`
setting (off by default). When enabled, every session, nested chat,
show-more, and placeholder row is indented 30px below its section header,
and nested custom groups step in by the same 30px, so the list reads as
a hierarchy.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: use a 20px indent for sessions list items
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: step session twisties in with their indented rows
Session twisties are positioned within the row, so they did not follow the
row contents' indent and showed at the wrong place for sessions in nested
groups or with indented items.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: use an 18px indent for sessions list items
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: keep comparisons and folder show-more aligned with indented items
Comparison headers, attempts, and their chats share the comparison's depth so
their guides connect, and the show more folders control sits at the top level
alongside section headers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
Polishes the artifact details context view in the Agents window.
### Changes
- **No transient status flicker.** After an action or an Autopilot
change, the GitHub PR integration briefly reports its state as `stale`
while it refreshes ("Pull request state is being refreshed. Actions are
paused." / "Showing the last known state while refreshing."). The
details view rendered that reason in its status line and list messages
for a moment. `stale`, like `loading`, is now never shown; only lasting
conditions (error, unavailable, sign-in required) are. Providers and
artifact tools still receive the reason.
- **Whole section heading toggles.** Clicking anywhere on the Autopilot
or Activities heading expands or collapses it, except on the Autopilot
switch. The heading shows list hover feedback, which is suppressed while
the pointer is over the switch. The disclosure button stays the single
keyboard target.
- **Activities.** Skipped runs (the automation found nothing to do) are
no longer listed. Rows use the action's icon (comments, CI, merge
conflict, PR, merge) instead of state icons that looked like check
results. Fix Checks now uses the `github-action` CI icon.
- **Workspace setting.** `.vscode/settings.json` ignores the `VS Code PR
Check` check before automatically marking PRs ready.
### Validation
- `./scripts/test.sh --run
src/vs/sessions/contrib/chat/test/browser/artifactIntegrationPresentation.test.ts
--run
src/vs/platform/agentHost/test/node/githubPullRequestArtifactIntegration.test.ts`:
passed (177 tests). New tests cover hidden refresh status, heading
clicks and hover, and hidden skipped activities with action icons. The
refresh-status test was confirmed to fail without the fix.
- `npm run typecheck-client`: passed
- `npm run eslint` on the changed TypeScript files: passed
Not run: the component screenshot suite. Activity row icons changed, so
screenshot baselines may need updating.
* mcp: remove unused inputs when uninstalling servers
Remove input definitions referenced only by uninstalled servers while preserving unrelated inputs, transitive dependencies, and references across configuration scopes in the current workspace.
Fixes#253289
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* mcp: preserve dependencies of duplicate input declarations
Visit every retained declaration sharing an input ID instead of only the first. Cover both declaration orders and ensure exclusive inputs are still removed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* mcp: preserve uninstall profile and identify unreadable scopes
Keep uninstall bound to the server's original configuration across profile switches during preservation scans. Include the failing resource in scan errors while retaining the original cause and fail-closed behavior.
Follow-up to #253289 and #269183.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* mcp: target the original remote profile during uninstall
Forward the server's configuration resource to the remote backend so uninstall cannot fall back to the default profile. Exercise real profile routing through IPC and preserve shared inputs in the regression test.
Follow-up to #253289 and #269183.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Let users mark a side chat as done without completing its parent or sibling chats.
- Accept side-chat archive and restore actions in loaded and unloaded agent-host sessions.
- Keep each chat's completion state after an agent-host restart.
- Add Done and Restore actions to child chats in the editor Sessions list.
- Route archive and read actions to the exact chat URI supplied by the host.
- Hide completed child chats unless the list includes archived chats.
- Add host, provider, action, renderer, filter, and persistence regression tests.
- Update accessibility help for independent side-chat completion.
Fixes https://github.com/microsoft/vscode/issues/344622
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* mcp: preserve source-specific server enablement
Match configured MCP servers to runtimes by ID instead of borrowing state from a same-named source. Keep shadowed entries' enablement, actions, ARIA labels, and counts independent while preserving discovery precedence.
Fixes#339956
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* mcp: handle late runtime changes and widget disposal
Keep open MCP details subscribed by configured source ID when their runtime appears later. Ignore filtering after disposal so late gallery or installation completions cannot leak enablement observers. Add regression tests for both cases.
Refs #339956
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Connector authorization built its session from the default account session's scopes. With a narrow default session (user:email) it produced a Connector session without `repo`, which the Agent Host now never forwards in place of the account's Copilot credential, so users who authorized Connectors could not get a usable Connector credential. Connector authorization now also keeps the scopes of the credential the Agent Host would forward without Connectors, using a shared helper so both sides agree.
Reduce risk for the release:
- Ask the runtime about Connector ownership only when Copilot Connectors are enabled, bound the read to 10s, and stop a waiting token as soon as its authentication request settles.
- Drop the "Copilot connectors are turned off" prompt; a cancelled Connector authorization is logged instead.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With Copilot Connectors enabled, the Copilot credential forwarded to the agent host could be replaced by a narrower same-account session that has the Connector scope but not `repo`. The built-in GitHub MCP server then returned `insufficient_scope` with a challenge echoing `write:plugin_gateway_connections`. Both host and client classified it as Connector-owned by that scope, so Authenticate went through Connector authorization, no token was forwarded, and the tool call hung.
- Never downgrade the forwarded GitHub credential. A Connector-scoped session replaces it only when it keeps every scope of the session the account would use without Connector authorization.
- Classify Connector ownership from the runtime's Connector state, never from the challenge's scope or the server's reported source. When published Connector state doesn't know a server, the host asks the runtime with connectors.getStatus(). The runtime lists a Connector's server before it asks for that server's authentication. The request is still registered and published right away, so an MCP inventory response already on its way cannot overwrite it. A token that arrives before the runtime answers waits for the answer.
- Servers identified this way publish their Connector name, so clients route by it and a targeted Connector refresh can release their pending request during an active turn. Clients no longer infer ownership from scopes, and automations skip MCP authentication for Connector-owned servers.
- Log silent Authenticate exits and cancelled Connector authorization, and show an actionable notification when Copilot connectors are turned off.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
## What
Automation run sessions are listed only in Automations. This lets a user
also bring one into the Sessions list:
- **On request:** *Show in Sessions List* in a run's context menu in
Automations. *Hide from Sessions List* (in both Automations and the
Sessions list) lists it only in Automations again.
- **Automatically:** `sessions.list.showAutomationSessions`
(experimental, experiment-enabled) controls when automation sessions
also appear in the Sessions list: `always`, `afterReply` (default — once
the user sends a message in the session), or `never`.
- **Explicit choices win:** an explicit Hide is persisted, so neither
later messages nor the `always` setting bring the session back, across
reloads and restarts. *Show in Sessions List* clears it and lists the
session even when the setting is `never`.
- **Automations entry indicator:** the unread / in-progress /
needs-input indicator on the Automations entry ignores runs whose
session is in the Sessions list, so that state appears only on the
session's own row. Runs whose session hasn't loaded yet still count.
## How
- `ISessionsListModelService` owns the listing rule and state
(`isSessionListed`, `showAutomationSessions`,
`showRepliedAutomationSession`, `hideAutomationSessions`): explicit
shown/hidden sets in profile-scoped storage keyed by session ID, plus
the setting. Changing the setting fires list changes for affected
sessions. It's client-side, so it works for every provider's automation
runs, survives temporary provider-catalog eviction, and is cleared only
on deletion.
- `AutomationSessionsListingContribution` listens to
`IChatService.onDidAcceptRequest`, which already excludes
system-initiated and hidden requests. Automation runs are dispatched
remotely (agent host / GitHub), so a run's own prompt never lists it.
- The Sessions list, its filter options (creating applications), agent
tools, and the Automations status indicator all use the same
`isSessionListed` rule instead of a hard-coded `!isAutomation`.
- Accessibility help for the Agents window chat and the Automations view
describes the actions and setting; actions announce their result.
- `SESSIONS_LIST.md` / `AUTOMATIONS.md` updated for the new list-owned
state.
## How to test
1. Open an automation run from Automations and send a message → it
appears in the Sessions list (and stays in Automations).
2. In the Sessions list, *Hide from Sessions List* → it's removed; send
another message → it stays hidden. Reload the window → still hidden.
3. In Automations, *Show in Sessions List* → it reappears.
4. With an unread or running automation session, the Automations entry
shows the indicator; after *Show in Sessions List*, the indicator moves
to the session row.
5. Set `sessions.list.showAutomationSessions` to `never` → replying no
longer lists the session; set it to `always` → every automation session
you haven't hidden appears.
## Validation
- `npm run typecheck-client` — passed
- `./scripts/test.sh --runGlob "vs/sessions/**/*.test.js"` — passed
(8809 passing)
- `npm run eslint -- <changed files>` — passed
- Manually launched Code OSS (Agents window) for testing; end-to-end UI
flow not automated.
When the latest runs were all skipped, the activities card hid before older history could be loaded. History paging now continues past pages that only contain skipped runs, and a collapsed card discovers older visible activity in the background.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Do not show transient refresh (stale) status in the artifact details view, which flickered after actions and Autopilot changes.
- Make the whole Autopilot and Activities heading toggle expansion and show hover feedback, except over the Autopilot switch.
- Hide skipped activities and use action-type icons instead of state icons that resembled check results; Fix Checks uses the CI icon.
- Ignore the 'VS Code PR Check' check before automatically marking PRs ready in this workspace.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: show pull request icons on the chat that recorded them
A pull request recorded by a peer chat showed its icon on the session row instead of the chat's own row. Chats now expose their own completed-state icon, attributing recorded pull requests to the recording chat (tool chats roll up to their parent) and discovered-only ones to the main chat; the session icon follows its main chat.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: attribute pull request icons by recorded link across folders
Keep a recorded pull request's owner even when it is not a listed chat, apply recorded ownership to pull requests any session folder discovered, and fall back to the open icon while a chat's own pull requests have no live state.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Normalize built-in and added-provider models and placeholders through one identity-keyed accumulator and shared finalization. Preserve destination identity, group ownership, ordering, icons, and own-row and empty-destination behavior.
Add characterization coverage for retention, provider presentation, combined entries, relayed ownership, fallback icons, and same-name identities.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: don't persist the diff base branch of ephemeral sessions
Ephemeral sessions (e.g. editor inline chat) are tombstoned at creation so
they never surface in history, and the central session state refuses writes
to tombstoned sessions. The first-send folder-isolation step persisted the
default diff base branch unconditionally, failing the request with
'Cannot write the session state of ...: tombstoned'.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: hide ephemeral sessions instead of deleting them
Ephemeral sessions (for example, editor inline chat) were tombstoned at creation to keep them out of
discovery. A tombstone also marks a session as deleted, so many write paths refused writes to the
live session. For example, a send failed with "Cannot write the session state of ...: tombstoned".
- Adds a separate "hidden" marker for ephemeral sessions. A hidden session is not registered and is
not tombstoned, so a tombstone again means only "deleted".
- Adds `isSessionSuppressed` (deleted or hidden). Uses it only in the checks that prevent
discovery, restore, surfacing, or reuse of a session identity.
- Keeps the hidden marker until teardown completes. Teardown deletes the session data, including
the provider session, and then removes the marker.
- Adds a sweep at provider registration. The sweep disposes hidden sessions that a previous host
left behind, for example after a crash.
- Does not persist the diff base branch of ephemeral sessions on the first send.
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: keep hidden session state and recheck the hidden sweep
- Keeps the central state of a session when the session is hidden. Hiding no longer removes state
that a provider persisted during creation (for example, provisional backing data), so later
writes to the live session do not fail.
- Rechecks that a session is still hidden and not live after a concurrent creation completes,
before the startup sweep disposes it.
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: defer proactive Connector authentication with MCP routing
Suppress unsolicited Connector sign-in hints when MCP tool routing is enabled, including screen-reader notifications and late ownership discovery. Keep tool-call authentication unchanged.
Fixes#344526
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: add deferred MCP routing for Connectors
Register searchable Connector activation tools after catalog discovery and preserve live tool replacement, cancellation, and session-account authorization. Handle status-only authorization requirements without caching account-owned tool metadata.\n\nRefs #344526.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: reject debugger discovery probes outside CAPI replay
Local dbgjs port discovery probes the replay proxy for DevTools endpoints. Return 404 before record/replay processing so external discovery neither enters fixtures nor causes teardown cache misses. Keep unknown API and model requests strict, with regression coverage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* test: move CAPI replay proxy fix to a separate PR
Remove the debugger-discovery proxy changes from the Connector routing PR. The identical fix is now independently proposed in #344629.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chat: simplify Connector routing activation
Replace the unbounded authentication loop with a single wait for readiness or a Connector challenge, one authentication step, and a readiness-only wait. Preserve cancellation and idle-time Connector reconciliation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: show details for individual MCP servers
Show a Markdown response for /mcp show <server> instead of the full server list.
- Read the configured server inventory without starting disconnected servers.
- Show known launch settings, configuration sources, errors, and available tools.
- Omit environment and header values. Report unknown servers and unavailable settings.
- Keep list commands and server changes on the runtime path.
- Add regression tests and update the agent host documentation.
Validation:
- 131 focused tests passed.
- Client type-check, changed-file ESLint, and diff checks passed.
- Live UI and provider tests were not run.
Fixes https://github.com/microsoft/vscode/issues/343402
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: preserve MCP details across runtime state changes
Keep MCP server details correct when runtime metadata is incomplete or changes.
- Use the shared source fallback without replacing explicit runtime sources.
- Log and show optional configuration lookup failures while keeping inventory details.
- Use live enablement for the displayed state and tool lookup.
- Add regression tests for missing sources, lookup failures, and runtime toggles.
Validation:
- 139 focused tests passed.
- Changed-file ESLint and editor diagnostics passed.
Fixes https://github.com/microsoft/vscode/issues/343402
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chat: hold the collapse transition mid-way instead of racing a real timer
The 'completion during collapse preserves reading position' tests waited a real 40 ms and then required the 180 ms collapse transition to still be running. On a loaded agent the timer can fire after the transition has ended, so getAnimations() is empty and runningTransition is false. Pause the transition 40 ms in, complete the response, then resume it, so the response always completes mid-collapse.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
#344512 added a retry for Apple timestamp stalls to sign.ts. sign-server.ts
signs each server Mach-O binary with its own `codesign --timestamp` call, so
the "Sign server binaries" step can still fail on the same stall. Wrap those
calls with the same retryOnTransientSignError.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Saving fires onDidChangeTextDocument without content changes. The Markdown
editor treated that as an external edit: it advanced the edit epoch, pushed
the document text to the webview and dropped edits the webview had already
made. With auto save this moved the caret and lost keystrokes while typing.
Fixes#342170
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
Agent Merge sometimes didn't kick in on pull requests with failing CI or
merge conflicts. This fixes two causes:
- **Failures behind required checks were ignored.** Only checks GitHub
reports as required counted. On microsoft/vscode the aggregate `PR Gate`
check is only created once every job it `needs:` has finished, so a
failed job went unrepaired for about 20 minutes. The Agents window, the
title bar and the PR artifact integration also each judged different
checks.
- **Single sign-on blocks were silent.** When GitHub refused the
credential for an organization's SAML single sign-on, the pull request
lookup only logged a warning. Agent Merge then waited forever while the
title bar showed it as on.
## Which checks count
- The pull request query reads the base branch's required checks from
branch protection and rulesets, and the `needs:` graph of the workflows
that report them, read at the head commit and cached. It marks the
checks that each unfinished required check waits for
([`pullRequestRequiredChecks.ts`](src/vs/platform/github/common/pullRequestRequiredChecks.ts)).
- One classifier decides everywhere:
- Required checks count, plus the checks an unfinished required check
waits for.
- Once a required check finishes, its own result decides.
- A required check that hasn't reported is pending.
- If the base branch requires nothing, every check counts.
- The surfaces that use it:
- Agent Merge: repairing, waiting and merging.
- The PR artifact integration: Fix CI, the orange PR icon, Mark Ready
and Merge.
- The agent host's title-bar readiness.
- The Agents window: CI state, Fix CI banner, Fix Checks and blocked
sessions. Its CI state shows as loading until the shared pull request
data has been read.
- The workbench GitHub pills.
-
`chat.artifactIntegrations.githubPullRequests.autoMarkReadyIgnoredChecks`
now also applies to Agent Merge's ready-for-review check. Each folder
uses its workspace value.
- Agent Merge also:
- Keeps a deferred workflow rerun when the gate that waits for the
deferred jobs reports its failure.
- Repairs a check suite that failed without reporting a check run, such
as a workflow that failed to start. `readAgentMergeCI` explains that
such a suite has no logs.
- Checks are polled sooner while a required check hasn't reported. The
Agents window re-reads which checks count when reruns change the
reported checks.
## Single sign-on
- The GitHub transport keeps the page GitHub names in `X-GitHub-SSO:
required; url=…`. It accepts only a secure `/orgs/<org>/sso` page on the
GitHub host the request went to. The page is carried through PR data
errors and errors passed between processes.
- `attachSessionGitHubPullRequest` now returns why a pull request lookup
failed.
- Agent Merge posts a new `AgentMergeBlocked` notice in two cases:
- Single sign-on blocks finding or reading its pull request. The notice
says "… [Sign in to <org>](…) to authorize it …". GitHub's link
expires after an hour, so a fresh notice follows only if Agent Merge is
still blocked then.
- No pull request turns up for its branch within 5 minutes.
- For the PR artifact integration, the `authenticationRequired` state
carries the page as `authorizationUrl`, and **Sign In** opens it instead
of signing in again.
## Notes for reviewers
- Behavior changes:
- When the base branch requires checks, a failing optional check no
longer shows Fix CI or the orange PR icon.
- A missing required check blocks merging and Mark Ready.
- The overall status shows failure as soon as one counted check fails.
- A cancelled check counts as failed.
- Workflows are read at the PR head, not the merge commit. YAML anchors
aren't supported, so jobs after an anchor contribute no dependencies.
- GitHub authorizes each token for single sign-on separately. The link
authorizes exactly the token Agent Merge used, which the Agents window
GitHub features share.
## How to test
Validation run on this commit:
- `npm run typecheck-client`: passed
- `npm run eslint -- <the 51 changed TypeScript files>`: passed
- `npm run valid-layers-check`: passed
- `./scripts/test.sh --reporter dot --runGlob
"**/{platform/github,platform/agentHost,platform/artifactIntegrations,sessions/contrib,sessions/services,workbench/contrib/chat/test/browser/agentSessions,workbench/contrib/chat/test/browser/agentHost,workbench/contrib/github,workbench/services/github}/**/*.test.js"`:
passed, 28,990 passing and 100 pending
Checked by hand during development:
- Ran the real GitHub client, query and gate code against live
microsoft/vscode PRs. With `PR Gate` not yet reported, #344458 got a Fix
CI repair for `Copilot - Test (Linux)` and `Copilot - Test (Windows)`,
and #344461 for `Windows / Electron-Smoke (shard 2/3)`.
- For the conflicting PRs #340701 and #344545, Agent Merge prompts only
`resolveConflicts`. GitHub Actions doesn't run on a conflicting head, so
its required checks stay pending.
Manual steps:
1. Turn on Agent Merge for a PR whose `PR Gate` jobs fail before `PR
Gate` reports. A Fix CI repair starts for the failed job, and the Agents
window's Fix CI banner lists that job.
2. Use a GitHub sign-in that isn't authorized for an organization's
single sign-on, and turn on Agent Merge for a PR there. A warning notice
with **Sign in to <org>** appears. After you authorize through the
link, Agent Merge continues within a minute.
Apply the repository formatter to the cleanup-state expression flagged by CI hygiene. No behavior changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate owning-host existence checks from disk measurements so archived leftovers stay retryable without recursive scans. Show zero only for confirmed removal, keep pending cleanup visible, and preserve selection through refreshes.
Propagate filesystem failures instead of treating them as missing paths, and cover protocol error mapping, cleanup reconciliation, and progress render coalescing.
Refs #344588
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refresh and republish every live customization anchor after successful SDK catalog and legacy plugin mutations so removed plugins cannot reappear as host-discovered entries. Use connection-neutral session labels for host-provided plugins, including accessible labels.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
Fixes microsoft/vscode-engineering#4368.
Follow-up to #344605. The focus failure reproduces when the regression
test focuses the Agent item through `toolbar.focus(1)`: the placement
binding focuses the input, but the queued menu rebuild preserves the
toolbar's old focus index and overrides that handoff.
- Restore input focus after the menu toolbar has rebuilt, using a
disposable one-shot listener that is cleared when placement changes or
the input is disposed.
- Assert that the Agent action really owns focus before changing modes;
retain the final input-focus assertion without adding sleeps.
- Cover enabling relocation while the picker is focused and preserving
focus elsewhere when it is not.
### Validation
- `npm run transpile-client` - passed.
- `git diff --check` - passed.
- `npm run eslint --
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts
src/vs/workbench/contrib/chat/test/browser/widget/input/modePickerActionItem.test.ts`
- passed.
Electron - **70 passed**:
```sh
./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/widget/input/modePickerActionItem.test.ts --run src/vs/workbench/contrib/chat/test/browser/widget/input/chatInputPart.test.ts --run src/vs/workbench/contrib/chat/test/browser/widget/input/chatInputPickerResponsiveLayout.test.ts --reporter dot
```
Browser - **69 passed per engine** (Chromium, Firefox, WebKit) on macOS:
```sh
npm run test-browser-no-install -- --browser chromium --browser firefox --browser webkit --run src/vs/workbench/contrib/chat/test/browser/widget/input/modePickerActionItem.test.ts --run src/vs/workbench/contrib/chat/test/browser/widget/input/chatInputPart.test.ts --run src/vs/workbench/contrib/chat/test/browser/widget/input/chatInputPickerResponsiveLayout.test.ts --reporter dot
```
Before the production fix, the strengthened toolbar-focus test
reproduced the exact `{ anchored: true, inAttachContext: true, focused:
false }` failure in Electron.
Validation limitations:
- `npm run typecheck-client` - blocked by the existing
`terminalProcess.ts(603,28)` error: `Property 'setParentWindow' does not
exist on type 'IPty'`.
- `npm run build-fast -- --client-only` - blocked during gulp
prerequisites by an existing Copilot runtime/SDK mismatch
(`1.0.103-unstable.r40031404408.gba6c003` versus `1.0.103`); standalone
client transpilation above succeeded.
- Windows/Linux CI tasks and a full unit suite were not run locally;
cross-platform CI recovery remains to be verified.
Preserve the focused index across clear and push only when the action bar still owns DOM focus. This fixes the Agent picker handoff at its source and removes deferred input restoration, preserving focus moved elsewhere before the menu rebuild.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
<!-- Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:
https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
-->
Hides the workspace clear (X) button entirely when the workspace picker
is collapsed to an icon, preventing it from overlapping adjacent
controls. Keeps the folder icon visible on hover/focus while compact,
and restores the existing clear action when expanded.
Adds regression coverage for compact/expanded transitions at rest, with
keyboard focus, and while the picker is open.
Testing:
- `npm run compile` — passed after refreshing root dependencies.
- `./scripts/test.sh --run
src/vs/sessions/contrib/chat/test/browser/sessionWorkspacePicker.test.ts
--grep 'Workspace close button styles|renders workspace clearing|clears
the workspace from the experimental trigger' --reporter dot` — 10
passed, 2 focus-dependent tests skipped by the hidden Electron runner.
- `npm run eslint --
src/vs/sessions/contrib/chat/test/browser/sessionWorkspacePicker.test.ts`
— passed.
- `npm run stylelint --
src/vs/sessions/contrib/chat/browser/media/chatWidget.css` — passed.
- Live Agents window, with workspace opt-out enabled in an isolated
profile: used the workspace context menu's **Collapse to Icon** toggle;
verified the X is absent and folder icon remains on hover, then expanded
and verified the X returns. Verified Tab reaches the expanded X and
skips it when collapsed.
To reproduce: enable `sessions.chat.experimental.workspaceOptOut`,
select a workspace in the new-session composer, right-click its picker,
and toggle **Collapse to Icon**. Hover in both states.
Environment note: `npm run install-fast` refreshed root dependencies but
later encountered a registry E401 during nested installation. Subsequent
compilation, focused tests, lint, and the live Agents launch succeeded.
No registry configuration was changed.
Wait for the menu toolbar to rebuild before handing focus back to the input so its preserved focus index cannot override the handoff. Exercise toolbar-managed focus and verify the Agent item owns focus before relocation, including setting changes and unfocused pickers.
Fixesmicrosoft/vscode-engineering#4368
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The branch added for check suites that reported no check run left the
nested conditional below it one indentation level short of what the
hygiene formatter expects, failing Compile & Hygiene.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the picker open as provider catalogues load or reconnect.
- Observe catalogue and refresh state without blocking healthy providers.
- Keep the active item and search text when the list changes.
- Dispose picker subscriptions on acceptance or cancellation.
- Test late catalogue delivery, selection, and cancellation during refresh.
Fixes https://github.com/microsoft/vscode/issues/344445
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: reset context tier when switching Copilot chats to Auto
Switching a chat from a long-context model to Auto passed an omitted
context tier to session.setModel, so the SDK kept the stale
long_context tier. The Copilot runtime rejects Fusion Auto preferences
with a non-default context tier, failing every later turn with
modelSelectionFailed. Context tiers only apply to concrete models, so
explicitly reset to the default tier when selecting Auto.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit a1097f008c)
* agentHost: reset the context tier before switching to Auto
The runtime validates a Fusion Auto preference against the session's
current context tier before applying a tier passed in the same
session.setModel call, so a single call still fails when switching
from a long-context model. Reset the tier through session.options.update
first, then switch the model.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 86ad0da909)
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a Command Palette picker to run saved automations without opening the Automations view.
- Use the cached catalogue when available. Refresh only when the catalogue is not ready and empty.
- Check feature enablement and provider availability before dispatch.
- Add Open Run or Show Automations to the notification, and close it after 10 seconds.
- Test selection, catalogue loading, run actions, and notification cleanup.
Fixes https://github.com/microsoft/vscode/issues/344445
(Commit message generated by Copilot)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep completed worktrees visible until the editor closes, preserve selection and focus, and show selected count with estimated storage. Use WorkbenchTable with granular cell updates and keyboard support, and distinguish unavailable measurements from confirmed removal.\n\nRefs #344588.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* browserView: forward CDP target info changes for the page target
BrowserViewDebugger only forwarded Target.targetInfoChanged for sub-targets in _knownTargets, and the page target is deliberately kept out of that map. So the CDP proxy's page target kept the URL and title it had when the target was registered. When the initial navigation committed after a CDP client attached (as in remote workspaces, where loadURL first waits for the tunnel proxy), Target.getTargets reported '' indefinitely.
The integration test now waits (bounded) for the target to report about:blank instead of asserting immediately, since CDP correctly reports '' until the navigation commits.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update the CDP golden scenario for page target info updates
The page target now reports its navigation to index.html, so the golden gains one targetInfoChanged after Page.navigate commits (before the worker is created), and the close-time targetInfoChanged reports index.html instead of the stale blank URL.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Engineering - fail and retry a hung CLI clippy step
On Windows, cargo clippy in the CLI Lint step occasionally hangs until the
90-min job timeout (#344111, 5 hits since Sep 28). The step already has
retryCountOnTaskFailure, but a step timeout cancels the step and the agent
never retries a cancelled step. Run clippy through a small runner that
fails it after 10 min (the step takes ~1 min), kills its process tree and
stops the sccache server, so the existing retry runs instead.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Engineering - bound the clippy timeout cleanup
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Engineering - kill a hung clippy timeout cleanup with its process tree
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Engineering - also fail and retry a hung CLI cargo build
The 11:00 insider 489779 failed when `cargo build` in Windows (ARM64) CLI
Compile hung for 90 min until the job timed out, the same class of hang as
the clippy one. Run the Windows and macOS compile through runWithTimeout with
a 20 min deadline (the step takes 1.5-4 min), so the step's retry runs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Engineering - stop the command when runWithTimeout itself is cancelled
On POSIX the command runs in its own process group so its whole tree can be
killed at the deadline. That also means a SIGINT/SIGTERM/SIGHUP to the script,
for example from a cancelled pipeline step, didn't reach it: the script exited
and cargo or rustc kept running with no deadline. Kill the command's tree and
exit with 128+signal, and remove the handlers once the command finishes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: let test restarts finish graceful shutdown
The standalone server gave up on graceful shutdown after a fixed 4.5s.
On a loaded Windows CI agent the new session's catalog and default-chat
writes can still be queued by then, so the restarted host restored the
session under a synthesized default chat and dropped the host-local
turns recorded for the original one.
Add --shutdown-timeout so the integration harness can give the server
the graceful-shutdown time it already waits for (25s in CI and on
Windows, unchanged 4.5s elsewhere). The production default is unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: name the shutdown reserve and report a missing --shutdown-timeout value
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* agentHost: reject --shutdown-timeout values above the timer limit
Node clamps setTimeout delays above MAX_TIMEOUT_DELAY to 1 ms, so a larger value would end graceful shutdown almost immediately. Parse the flag in agentHostShutdown.ts so it can be unit tested.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>