Skip to content

sessions: preserve This Computer during composer restoration - #343503

Merged
Megan Rogge (meganrogge) merged 4 commits into
mainfrom
agents/fix-session-composer-layout-bug
Oct 22, 2026
Merged

Megan Rogge (meganrogge) merged 4 commits into
mainfrom
agents/fix-session-composer-layout-bug

Conversation

@meganrogge

@meganrogge Megan Rogge (meganrogge) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #343502

Summary

Keep an unchanged automatic environment default reactive during new-session workspace restoration. Previously, if Cloud registered before This Computer, the workspace-selection handler saved the temporary Cloud default as an explicit environment choice. The composer then stayed on Cloud after the local provider became available, including for local folders Cloud cannot serve.

Keep unchanged automatic defaults unpinned, but refresh explicit selections from the current environment list even when their ID is unchanged. This reuses the existing observable default selection and provider-change handling without adding persistence keys or provider-specific branching.

Add a deterministic regression test that restores a local folder while only Cloud is registered, then registers This Computer and checks that the selection updates without becoming pinned. The test fails on the original implementation.

CI and Review Follow-up

  • Preserve updated metadata/provider IDs for explicit environment selections with the same environment ID, with regression coverage.
  • Assert the automatic restoration test's initial and final outcomes rather than its exact observable notification sequence.
  • Repair an existing incomplete customization snapshot in the Computer Use activation-tools test. All three Electron CI platform jobs failed on customizations.discoveredAgents is not iterable; the same failure reproduces locally before this fixture-only fix. Include the empty discoveredAgents and additionalRootInstructions arrays used by neighboring fixtures. No Agent Host production behavior changes.

Validation

  • npm run build-fast — passed after refreshing stale runtime dependencies with npm run install-fast.
  • npm run build-fast -- --client-only — passed.
  • ./scripts/test.sh --run src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts --run src/vs/sessions/contrib/chat/test/browser/sessionEnvironmentPicker.test.ts --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts --reporter dot — passed, 331 tests.
  • npm run eslint -- src/vs/sessions/contrib/chat/browser/newChatWidget.ts src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts — passed.
  • node --experimental-strip-types build/hygiene.ts src/vs/sessions/contrib/chat/browser/newChatWidget.ts src/vs/sessions/contrib/chat/test/browser/newChatWidget.test.ts src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts — passed.
  • npm run typecheck-client — passed.
  • Live macOS Code OSS 1.144.0 Agents Window: enabled the experimental composer and environment picker, selected a local folder with no Git repository/remote, and verified This Computer after three consecutive Developer: Reload Window invocations.

How to Test

  1. Enable sessions.chat.unifiedWorkspacePicker.enabled, sessions.chat.experimental.newSessionComposerLayout, and sessions.chat.experimental.environmentPicker.
  2. Select a local folder and This Computer. No Git remote is required.
  3. Reload the Agents Window.
  4. Verify the composer settles on This Computer, not Cloud, once the local provider registers.

Avoid pinning the temporary Cloud default before the local provider registers during workspace restoration.

Fixes #343502

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 13:59
@meganrogge Megan Rogge (meganrogge) added this to the 1.144.0 milestone Oct 22, 2026
@meganrogge
Megan Rogge (meganrogge) enabled auto-merge (squash) October 22, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Preserves the “This Computer” automatic environment selection during new-session workspace restoration by avoiding inadvertently pinning a temporary default (e.g., Cloud) while providers are still registering.

Changes:

  • Prevents persisting _pickedEnvironment when the reconciled default matches the current automatic selection.
  • Adds a regression test covering provider-registration order during workspace restoration.
File Description
src/​vs/​sessions/​contrib/​chat/​browser/​newChatWidget.ts Avoids pinning an automatic environment default during workspace restoration when the computed default hasn’t actually changed.
src/​vs/​sessions/​contrib/​chat/​test/​browser/​newChatWidget.test.ts Adds a deterministic regression test for provider registration order (Cloud first, then This Computer) ensuring selection remains reactive.

Review effort: Lite

Refresh explicit environment selections with current metadata and assert restoration outcomes without depending on observable notification counts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Supply discovered agents and root instructions in the activation-tools fixture to fix the shared Electron CI failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: a70aac7d Current: 4e1d61f2

Changed (1)

sessions/artifactDetails/CommentsInformation/Light
Before After
before after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents Window resets This Computer to Cloud after reloading the new session composer

6 participants