Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: set Pi shellPath explicitly on Windows to avoid WSL/alias bash resolution failures

Louis Beaumont097e13be420b
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 1df69887e..6e5fd457a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9338,7 +9338,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.2.177"
+version = "2.2.182"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 4a7384daf..fb8442ed8 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.2.182"
+version = "2.2.183"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index f0637c8c4..b59839a04 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -1163,6 +1163,44 @@ pub async fn pi_start_inner(
}
}
info!("Injected bash dir into PATH for pi: {}", bash_dir);
+
+ // Write shellPath into Pi's settings.json so Pi uses this
+ // exact bash instead of its own resolution logic (which may
+ // find a WSL stub or Windows App Alias on machines without
+ // Git for Windows).
+ let bash_exe = Path::new(&bash_dir).join("bash.exe");
+ if bash_exe.exists() {
+ if let Ok(config_dir) = get_pi_config_dir() {
+ let settings_path = config_dir.join("settings.json");
+ let mut settings: serde_json::Value = if settings_path.exists() {
+ std::fs::read_to_string(&settings_path)
+ .ok()
+ .and_then(|c| serde_json::from_str(&c).ok())
+ .unwrap_or_else(|| json!({}))
+ } else {
+ json!({})
+ };
+ if let Some(obj) = settings.as_object_mut() {
+ obj.insert(
+ "shellPath".to_string(),
+ json!(bash_exe.to_string_lossy()),
+ );
+ }
+ let _ = std::fs::create_dir_all(&config_dir);
+ if let Err(e) = std::fs::write(
+ &settings_path,
+ serde_json::to_string_pretty(&settings).unwrap_or_default(),
+ ) {
+ warn!("failed to write Pi shellPath setting: {}", e);
+ } else {
+ info!(
+ "Set Pi shellPath to {} in {:?}",
+ bash_exe.display(),
+ settings_path
+ );
+ }
+ }
+ }
}
None => {
warn!("bash not available — Pi's bash tool may fail on Windows");
diff --git a/crates/screenpipe-core/src/agents/pi.rs b/crates/screenpipe-core/src/agents/pi.rs
index c03baefe0..d9dc3d17e 100644
--- a/crates/screenpipe-core/src/agents/pi.rs
+++ b/crates/screenpipe-core/src/agents/pi.rs
@@ -1280,7 +1280,51 @@ fn build_async_command(path: &str) -> tokio::process::Command {
if let Some(bun_path) = find_bun_executable() {
if let Some(bun_dir) = std::path::Path::new(&bun_path).parent() {
let current_path = std::env::var("PATH").unwrap_or_default();
- let new_path = format!("{};{}", bun_dir.display(), current_path);
+ let mut new_path = format!("{};{}", bun_dir.display(), current_path);
+
+ // On Windows, inject bash into PATH for Pi's bash tool.
+ // Check bundled PortableGit, then standard Git for Windows paths.
+ {
+ let bash_dirs: Vec<std::path::PathBuf> = {
+ let mut dirs = Vec::new();
+ // 1. Bundled PortableGit
+ if let Some(local_app_data) = std::env::var_os("LOCALAPPDATA") {
+ let bundled = std::path::PathBuf::from(&local_app_data)
+ .join("screenpipe")
+ .join("git-portable")
+ .join("bin");
+ if bundled.join("bash.exe").exists() {
+ dirs.push(bundled);
+ }
+ }
+ // 2. Standard Git for Windows
+ if dirs.is_empty() {
+ for p in &[
+ r"C:\Program Files\Git\bin",
+ r"C:\Program Files (x86)\Git\bin",
+ ] {
+ let dir = std::path::PathBuf::from(p);
+ if dir.join("bash.exe").exists() {
+ dirs.push(dir);
+ break;
+ }
+ }
+ }
+ dirs
+ };
+ if let Some(bash_dir) = bash_dirs.first() {
+ new_path = format!("{};{}", bash_dir.display(), new_path);
+ // Also add usr/bin for common unix utils (grep, cat, etc.)
+ if let Some(parent) = bash_dir.parent() {
+ let usr_bin = parent.join("usr").join("bin");
+ if usr_bin.exists() {
+ new_path = format!("{};{}", usr_bin.display(), new_path);
+ }
+ }
+ debug!("injected bash dir into PATH for pi: {}", bash_dir.display());
+ }
+ }
+
cmd.env("PATH", new_path);
debug!("injected bun dir into PATH for pi: {}", bun_dir.display());
}