Skip to content

ux(vscode): quick-pick workspace root for ambiguous multi-root starts (#2077) - #2180

Merged
EffortlessSteven merged 3 commits into
mainfrom
codex/vscode-root-picker
Jul 22, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
codex/vscode-root-picker

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Fixes #2077: a multi-root workspace with no active file editor (or an untitled buffer focused) refused server start with workspaceAmbiguous and told the user to "select one workspace folder" — with no in-product way to do so. The only escape hatch (open a Rust file from one folder) was undocumented in the README.

  • ripr: Select Workspace Root (palette + contributes.commands): quick-pick over workspace.workspaceFolders (name + fsPath via the pure, testable workspaceRootPickItems()).
  • Session-scoped pick: consulted only when the document-driven root state is ambiguousMultiRoot — the active-document disambiguation always wins, and a stale pick (folder removed from the workspace) falls back to ambiguous. ripr: Restart Server after picking reuses the pick through the SAME single-server start path.
  • Warning affordance: the blocked start path offers "Select Workspace Root" as a warning action running the identical flow; the ambiguous-state nextStep strings (status bar + server status) name the new command instead of only "open a Rust file".
  • No onCommand activationEvents entry (commented in extension.ts): VS Code ≥1.74 auto-activates on contributed commands and engines is ^1.90.0.

Closes #2077

Test evidence

Six new fake-runtime tests (test/suite/workspace_root_picker.test.ts, the suite the runner actually executes): pick-list shape; palette pick starts server with cwd = picked root; ambiguous-start warning action starts for the picked root; dismissal keeps the server stopped; restart reuses the pick without re-showing; stale pick falls back to ambiguous. showQuickPick is unstubbable in test-electron, so coverage goes through the runtime seam + pure function (stated in the file header).

e2e (xvfb-run -a npm run test:e2e, real VS Code): branch 92 passing / 5 failing; baseline at origin/main 84 passing / 7 failing — all 5 branch failures are pre-existing harness/environment failures on main (same test names), confirmed by the baseline run; zero new failures. Logs verified by the integrator (/tmp/e2e-2077-rerun.log, /tmp/e2e-baseline.log).

Validation

  • npm ci + cargo xtask vscode-compile — clean
  • cargo xtask check-file-policy / check-static-language / check-doc-index — exit 0

Noted follow-up

src/test/multiroot.test.ts compiles to out/src/test/ but is never executed by the test runner (the live suite is test/suite/) — dead test code flagged for separate cleanup.

…#2077)

A multi-root workspace with no active file editor refused server start
with workspaceAmbiguous and told the user to 'select one workspace
folder' — with no in-product way to do so. ripr: Select Workspace Root
now offers a quick pick over the workspace folders (name + path); the
pick is session state consulted only when the document-driven root
state is ambiguous (the active-document disambiguation always wins, and
a stale pick falls back to ambiguous). The blocked start path also
offers the same flow from a warning action. One server for one folder;
the single-server model is unchanged.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a7327679-ce64-46c8-8a93-6603c816c831

📥 Commits

Reviewing files that changed from the base of the PR and between 568e27b and e5a5d02.

📒 Files selected for processing (1)
  • editors/vscode/src/client.ts

Walkthrough

The VS Code extension adds a ripr.selectWorkspaceRoot command and picker for ambiguous multi-root workspaces. Selected roots are reused during session restarts, with updated controller APIs, documentation, command registration, and tests.

Changes

Workspace Root Selection

Layer / File(s) Summary
Runtime and picker contract
editors/vscode/src/client.ts
The runtime exposes workspace folders and typed quick picks, while picker items carry folder labels, paths, and roots.
Controller selection flow
editors/vscode/src/client.ts, editors/vscode/test/suite/workspace_root_picker.test.ts
Ambiguous starts offer root selection without blocking activation; selected roots are applied on restart and reused while still present.
Command wiring and validation
editors/vscode/package.json, editors/vscode/src/extension.ts, docs/*, editors/vscode/README.md, editors/vscode/test/suite/*
The command is contributed, registered, documented, asserted in smoke tests, and added to runtime mocks.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant VSCode
  participant RiprClientController
  User->>VSCode: Run ripr.selectWorkspaceRoot
  VSCode->>RiprClientController: selectWorkspaceRoot()
  RiprClientController-->>VSCode: Show workspace folders
  User->>VSCode: Pick workspace folder
  VSCode->>RiprClientController: Selected root
  RiprClientController->>RiprClientController: Restart server with selected cwd
Loading

Possibly related PRs

Poem

I’m a bunny in a workspace wide,
Picking roots with ears held high.
A quick-pick hop, a server restart,
The chosen folder warms its heart.
No file required—just choose and fly!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, tests, and validation, but it omits most required template sections like scope, rollback, and traceability. Fill in the repository template sections, especially Swarm/Source Boundary, Scope, Proof, Claim Boundary, Rollback, and Spec-Test-Code Traceability.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the new VS Code quick-pick workspace-root feature for ambiguous multi-root starts.
Linked Issues check ✅ Passed The PR implements #2077 by adding a workspace-root picker and surfacing it from the ambiguous-start warning.
Out of Scope Changes check ✅ Passed The changes stay focused on the VS Code workspace-root picker, related docs, and tests, with no clear unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/vscode-root-picker

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e14f2cb7b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread editors/vscode/src/client.ts Resolved
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…2077)

Review (codex P2): awaiting the warning notification inside start()
blocked start — and extension activation, which awaits it — until the
user answered, which may never happen. The warning is now fire-and-
forget; accepting the action still runs the picker flow.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
editors/vscode/src/client.ts (1)

294-322: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Un-awaited offerWorkspaceRootSelection() promise has no observable outcome — root cause of both an error-handling gap and a racy test assertion.

Both sites stem from the same root cause: void this.offerWorkspaceRootSelection(); discards its promise, so nothing can attach error handling to it and nothing can await its completion.

  • editors/vscode/src/client.ts#L294-L322: attach a .catch() to the fire-and-forget call (mirroring the existing warnWithOutput pattern elsewhere in this file) so a failure deep in the deferred restart chain (e.g. client.start() rejecting) is logged instead of becoming a silent unhandled rejection.
  • editors/vscode/test/suite/workspace_root_picker.test.ts#L167-L183: the assertion on harness.serverCwds at line 182 depends on that same un-awaited chain reaching createLanguageClient; verify (or restructure the test to explicitly wait on) that chain's completion before asserting, since await controller.start() can resolve well before it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editors/vscode/src/client.ts` around lines 294 - 322, Attach a rejection
handler to the fire-and-forget offerWorkspaceRootSelection() call in
editors/vscode/src/client.ts lines 294-322, following the existing
warnWithOutput pattern so deferred restart failures are logged. In
editors/vscode/test/suite/workspace_root_picker.test.ts lines 167-183,
explicitly wait for the workspace-root selection/restart chain to reach
createLanguageClient before asserting harness.serverCwds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@editors/vscode/src/client.ts`:
- Around line 467-539: Update selectWorkspaceRoot() and the active-document
resolution path around resolveWorkspaceRootState() to detect when the newly
stored selectedWorkspaceRoot differs from the runtime-selected root and is
therefore superseded. Emit a clear output or user-facing notice explaining that
the active document determines the workspace root, while preserving the existing
preference for active-document resolution and the current ambiguousMultiRoot
selection behavior.

---

Outside diff comments:
In `@editors/vscode/src/client.ts`:
- Around line 294-322: Attach a rejection handler to the fire-and-forget
offerWorkspaceRootSelection() call in editors/vscode/src/client.ts lines
294-322, following the existing warnWithOutput pattern so deferred restart
failures are logged. In editors/vscode/test/suite/workspace_root_picker.test.ts
lines 167-183, explicitly wait for the workspace-root selection/restart chain to
reach createLanguageClient before asserting harness.serverCwds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 64e95107-14ef-41da-b7d6-e9a2feb027d8

📥 Commits

Reviewing files that changed from the base of the PR and between b128a0b and 568e27b.

📒 Files selected for processing (11)
  • docs/CONFIGURATION.md
  • docs/TESTING.md
  • editors/vscode/README.md
  • editors/vscode/package.json
  • editors/vscode/src/client.ts
  • editors/vscode/src/extension.ts
  • editors/vscode/test/suite/extension.test.ts
  • editors/vscode/test/suite/show_output_action.test.ts
  • editors/vscode/test/suite/workspace_root_picker.test.ts
  • editors/vscode/test/suite/workspace_trust_runtime.test.ts
  • editors/vscode/test/suite/workspace_trust_transition.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • EffortlessMetrics/ripr (auto-detected)
  • EffortlessMetrics/perl-lsp (auto-detected)
  • EffortlessMetrics/unsafe-review (auto-detected)
  • EffortlessMetrics/ub-review (auto-detected)

Comment thread editors/vscode/src/client.ts Resolved
…ring it silently (#2077)

Review: a session pick whose folder left the workspace was ignored with
no signal. It now logs why the pick is not applied and clears it, so a
later ambiguous resolution does not keep skipping a dead selection.
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.

ux(vscode): multi-root workspace has no folder-picker — server refuses to start unless a file from one root is open

1 participant