diff --git a/CHANGELOG.md b/CHANGELOG.md index 795c0f6a3b..fae28359e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,11 @@ every deployment: ### OpenBot Desktop +- **A Windows machine that has only WSL 1 is now told how to convert it.** When the WSL + `DefaultVersion` registry value was absent, setup reported WSL 2 and then tried + `wsl.exe --version`, which the older inbox binary does not understand, so it ended on "could not + check the WSL version" with no next step. An absent value now means WSL 1, and setup shows the + `wsl --set-default-version 2` instructions. - **OpenBot Desktop 1.0.2 and 1.0.3 can start an installation a newer version updated.** Put back over one, they stopped with "container-images.json for … names no agent-bot image". For one release, `container-images.json` names `agent-bot` and `agent-langgraph` again, both as the diff --git a/desktop/src-tauri/src/windows.rs b/desktop/src-tauri/src/windows.rs index 1dfab9acde..71c49030c2 100644 --- a/desktop/src-tauri/src/windows.rs +++ b/desktop/src-tauri/src/windows.rs @@ -132,14 +132,18 @@ impl Blocker { } /// Query the same current-user WSL registry value that upstream uses for the default version. +/// +/// Windows treats an absent `DefaultVersion` as WSL 1, not WSL 2. Reporting 2 here skipped the +/// WSL1 screen and sent setup to `wsl.exe --version`, which the legacy inbox binary does not +/// understand. fn default_wsl_version_probe_command() -> &'static str { r#"$ErrorActionPreference = 'Stop'; $path = 'Software\Microsoft\Windows\CurrentVersion\Lxss'; $key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($path); -if ($null -eq $key) { 2; return } +if ($null -eq $key) { 'unset'; return } try { $value = $key.GetValue('DefaultVersion', $null); - if ($null -eq $value) { 2; return } + if ($null -eq $value) { 'unset'; return } if ($value -isnot [int]) { throw 'DefaultVersion is not a registry DWORD' } $value } finally { @@ -149,6 +153,8 @@ try { fn parse_default_wsl_version(operation: &str, output: &str) -> Result { match output.trim() { + // No DefaultVersion value means new distributions default to WSL 1. + "unset" => Ok(1), "1" => Ok(1), "2" => Ok(2), other => Err(detection_failed( @@ -1367,6 +1373,37 @@ mod tests { assert_eq!(result, Ok(None)); } + #[test] + fn an_unset_default_version_is_wsl_one() { + assert_eq!( + parse_default_wsl_version("the default WSL version (registry)", "unset"), + Ok(1) + ); + } + + #[test] + fn an_unset_default_version_reaches_the_wsl_one_screen() { + let mut probe = 0; + let result = blocker_with( + |program, args| { + assert_probe_call(probe, program, args); + let output = if probe == 4 { + "unset\n" + } else { + PROBE_OUTPUTS[probe] + }; + probe += 1; + Ok(probe_output(0, output, "")) + }, + || panic!("WSL1 must be reported before the kernel check"), + ); + assert_eq!(result, Ok(Some(Blocker::WslOne))); + assert_eq!( + probe, 5, + "the unsupported wsl.exe --version probe must not run" + ); + } + fn probe_with_modern_wsl_service( outputs: [&str; 6], service: std::io::Result,