A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io
Rust ai-toolsclaude-codecodexdeepseek-harnessdesktop-appgrokgrokbuildhermeskimi-codemcpopen-sourceopencodepiprovider-managementrustskillsskills-managementtauriwsl-support
fix(tools): skip the symlinked VS Code copilot-shim on Linux
Jasonec997c4c0ca4
diff --git a/src-tauri/src/commands/tool_discovery.rs b/src-tauri/src/commands/tool_discovery.rsindex 765193c04..514a28375 100644--- a/src-tauri/src/commands/tool_discovery.rs+++ b/src-tauri/src/commands/tool_discovery.rs@@ -269,7 +269,11 @@ pub(super) fn tool_executable_candidates(tool: &str, dir: &Path) -> Vec<std::pat#[cfg(not(target_os = "windows"))]{- vec![dir.join(tool)]+ let candidate = dir.join(tool);+ if is_vscode_copilot_shim_launcher(tool, &candidate) {+ return Vec::new();+ }+ vec![candidate]}}@@ -754,7 +758,6 @@ fn is_foreign_pip_launcher(tool: &str, path: &Path) -> bool {/// "GitHub Copilot CLI was not found" when the real CLI is missing. It sits on PATH under/// the tool's own name but is never the CLI, so probing it reports "installed but broken"/// instead of "not installed". Matched by its directory, which covers `.exe` and `.cmd`.-#[cfg(any(target_os = "windows", test))]fn is_vscode_copilot_shim(tool: &str, path: &Path) -> bool {tool == "copilot"&& path@@ -764,6 +767,16 @@ fn is_vscode_copilot_shim(tool: &str, path: &Path) -> bool {.contains("/copilot-shim/")}+/// On Linux the VS Code package links `/usr/bin/copilot` to its+/// `bin/copilot-shim/copilot` placeholder (#10228), so the launcher path alone does not+/// show it: follow the link and match the target as well.+#[cfg(not(target_os = "windows"))]+fn is_vscode_copilot_shim_launcher(tool: &str, path: &Path) -> bool {+ tool == "copilot"+ && (is_vscode_copilot_shim(tool, path)+ || std::fs::canonicalize(path).is_ok_and(|real| is_vscode_copilot_shim(tool, &real)))+}+/// OpenCode Desktop has shipped both root-level and Electron `resources/` CLI sidecars./// Some Electron releases omitted the sidecar; `resources/app.asar` still identifies the/// Desktop bundle, so skip its GUI instead of probing `opencode.exe` with `--version`.@@ -1314,6 +1327,9 @@ pub(super) fn resolve_path_default_entry(let Some(real) = std::fs::canonicalize(&launcher).ok() else {return Ok(None);};+ if is_vscode_copilot_shim(tool, &launcher) || is_vscode_copilot_shim(tool, &real) {+ return Ok(None);+ }Ok(Some(ResolvedPathDefault { launcher, real }))}diff --git a/src-tauri/src/commands/tool_discovery/tests.rs b/src-tauri/src/commands/tool_discovery/tests.rsindex 948f9c72e..d96b29871 100644--- a/src-tauri/src/commands/tool_discovery/tests.rs+++ b/src-tauri/src/commands/tool_discovery/tests.rs@@ -1127,6 +1127,56 @@ fn foreign_shims_are_rejected() {));}+/// Linux VS Code links `/usr/bin/copilot` to its `copilot-shim` placeholder, which exits+/// 127 with "GitHub Copilot CLI was not found"; it must read as not installed (#10228).+#[cfg(unix)]+#[test]+fn symlinked_vscode_copilot_shim_is_not_an_install() {+ use std::os::unix::fs::PermissionsExt;++ let dir = tempfile::tempdir().expect("temp dir should be created");+ let shim = dir.path().join("share/code/bin/copilot-shim/copilot");+ std::fs::create_dir_all(shim.parent().unwrap()).unwrap();+ std::fs::write(+ &shim,+ "#!/bin/sh\necho 'GitHub Copilot CLI was not found.'\nexit 127\n",+ )+ .unwrap();+ std::fs::set_permissions(&shim, std::fs::Permissions::from_mode(0o755)).unwrap();+ let bin = dir.path().join("bin");+ std::fs::create_dir_all(&bin).unwrap();+ std::os::unix::fs::symlink(&shim, bin.join("copilot")).unwrap();++ assert!(tool_executable_candidates("copilot", &bin).is_empty());+ assert!(tool_executable_candidates("copilot", shim.parent().unwrap()).is_empty());+ assert!(matches!(+ scan_cli_version_in("copilot", std::slice::from_ref(&bin)),+ ShellProbe::NotFound(_)+ ));++ // A real CLI elsewhere is still found, and other tools are not affected.+ let real_bin = dir.path().join("npm/bin");+ std::fs::create_dir_all(&real_bin).unwrap();+ std::fs::write(real_bin.join("copilot"), "#!/bin/sh\necho 1.0.0\n").unwrap();+ std::fs::set_permissions(+ real_bin.join("copilot"),+ std::fs::Permissions::from_mode(0o755),+ )+ .unwrap();+ assert_eq!(+ tool_executable_candidates("copilot", &real_bin),+ vec![real_bin.join("copilot")]+ );+ assert!(matches!(+ scan_cli_version_in("copilot", &[bin.clone(), real_bin]),+ ShellProbe::Found(version) if version == "1.0.0"+ ));+ assert_eq!(+ tool_executable_candidates("codex", &bin),+ vec![bin.join("codex")]+ );+}+#[cfg(target_os = "windows")]#[test]fn cli_path_env_skips_windows_apps_alias_dir() {