cli: respect VSCODE_PORTABLE and make Quality parsing case-insensitive by rahadbhuiya · Pull Request #341565 · microsoft/vscode · GitHub
Skip to content

cli: respect VSCODE_PORTABLE and make Quality parsing case-insensitive - #341565

Merged
Connor Peet (connor4312) merged 2 commits into
microsoft:mainfrom
rahadbhuiya:fix/cli-portable-mode-paths
Oct 14, 2026
Merged

Connor Peet (connor4312) merged 2 commits into
microsoft:mainfrom
rahadbhuiya:fix/cli-portable-mode-paths

Conversation

@rahadbhuiya

Copy link
Copy Markdown
Contributor

Fixes #184646

Summary

  1. Respect VSCODE_PORTABLE in CLI Paths (Fixes .vscode\cli\ ignores portable mode #184646):

    • When running in portable mode, VS Code defines the VSCODE_PORTABLE environment variable pointing to the portable data directory.
    • Previously, the CLI launcher (LauncherPaths::migrate, LauncherPaths::new, and �gent_host_root) fell back directly to dirs::home_dir(), causing ~/.vscode/cli or %USERPROFILE%.vscode\cli to be created even when portable mode was intended.
    • LauncherPaths now inspects VSCODE_PORTABLE first before defaulting to the user's home directory, ensuring CLI cache, state, and supervisor logs stay self-contained within the portable data folder.
    • Added unit tests est_launcher_paths_portable_mode and est_launcher_paths_explicit_root.
  2. Case-Insensitive Quality::try_from Parsing:

    • Made Quality::try_from case-insensitive (s.to_ascii_lowercase().as_str()) so inputs like "Stable" or "Insiders" resolve correctly without requiring callers to manually lower-case strings first.
    • Added unit tests covering all Quality variants, display formatting, and TelemetryLevel display.

In portable mode, VS Code sets VSCODE_PORTABLE to point to the portable data directory. LauncherPaths now respects VSCODE_PORTABLE so CLI data and agent host logs do not leak into ~/.vscode/cli (Fixes microsoft#184646). Also makes Quality::try_from case-insensitive and adds unit tests.
Copilot AI balanced review requested due to automatic review settings October 14, 2026 15:21
@rahadbhuiya

Copy link
Copy Markdown
Contributor Author

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.

🟡 Changes recommended

Home-token expansion rewrites literal portable paths, causing inconsistent or invalid storage locations.

1 open finding
What changed in this PR

Updates CLI storage paths to respect portable mode, addressing #184646, and makes quality parsing case-insensitive.

Changes:

  • Uses VSCODE_PORTABLE for launcher data and agent-host paths.
  • Accepts mixed-case quality names.
  • Adds path, parsing, and display tests.
File Description
cli/​src/​state.rs Adds portable-path handling and launcher tests.
cli/​src/​options.rs Adds case-insensitive quality parsing and parsing/display tests.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/src/state.rs Outdated
Comment on lines +174 to +181

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Updated in commit 249c9dd to pass VSCODE_PORTABLE paths directly to new_for_path as a PathBuf without home-token expansion, preserving paths with literal '~' (e.g. Windows 8.3 short paths), and updated the test suite accordingly.

Directly pass VSCODE_PORTABLE paths to new_for_path without home-token expansion, preserving paths that contain literal ~ characters (such as Windows short names).

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@connor4312
Connor Peet (connor4312) merged commit a4d6dc1 into microsoft:main Oct 14, 2026
35 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 14, 2026
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.

.vscode\cli\ ignores portable mode

5 participants