All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
fix(remote): skip sockets and FIFOs during sync
Corey Chiu39b58d2f2c90
diff --git a/crates/wake-core/src/remote.rs b/crates/wake-core/src/remote.rsindex a347c39..0cd27bc 100644--- a/crates/wake-core/src/remote.rs+++ b/crates/wake-core/src/remote.rs@@ -353,7 +353,15 @@ fn present_remote_paths(stdout: &str) -> Vec<&'static str> {/// 布局;`--delete` 让远程删除传播到缓存(watcher 收 Remove 后清库内行)——/// 它只作用于各源树**内部**,整棵源消失由 sync_host 的缺席清理负责。fn rsync_args(host: &str, dest: &Path, paths: &[&str]) -> Vec<String> {- let mut args = vec!["-az".to_string(), "-R".to_string(), "--delete".to_string()];+ // -a enables special files. Override it afterwards: sockets/FIFOs carry no+ // session data, and recreating sockets under a long cache path can exceed+ // sun_path and abort openrsync's receiver (#47).+ let mut args = vec![+ "-az".to_string(),+ "-R".to_string(),+ "--delete".to_string(),+ "--no-specials".to_string(),+ ];args.extend(REMOTE_LAYOUTS.iter()@@ -676,6 +684,12 @@ mod tests {let present = [".claude/projects", ".codex/state_5.sqlite"];let args = rsync_args("devbox", Path::new("/tmp/cache/devbox"), &present);assert_eq!(args[0], "-az");+ let archive = args.iter().position(|a| a == "-az").unwrap();+ let no_specials = args.iter().position(|a| a == "--no-specials").unwrap();+ assert!(+ no_specials > archive,+ "--no-specials must follow -a, which enables special files"+ );assert!(args.contains(&"-R".to_string()));assert!(args.contains(&"--delete".to_string()));assert!(argsdiff --git a/crates/wake-core/tests/remote_sync.rs b/crates/wake-core/tests/remote_sync.rsindex a6c40ba..50c90e3 100644--- a/crates/wake-core/tests/remote_sync.rs+++ b/crates/wake-core/tests/remote_sync.rs@@ -16,6 +16,7 @@use std::collections::HashSet;use std::fs;use std::os::unix::fs::PermissionsExt;+use std::os::unix::net::UnixListener;use std::path::Path;use std::sync::Arc;use wake_core::adapters::create_adapter_roster_for;@@ -80,7 +81,9 @@ fn remote_pipeline_end_to_end() {eprintln!("rsync not installed; skipping remote sync e2e");return;}- let tmp = tempfile::tempdir().unwrap();+ // Keep the source socket path short even on macOS, whose default temp dir+ // has a long /var/folders prefix. The mirror is deliberately much deeper.+ let tmp = tempfile::tempdir_in("/tmp").unwrap();let home = tmp.path().join("remote-home");let bin = tmp.path().join("bin");let local_home = tmp.path().join("local-home");@@ -122,11 +125,31 @@ fn remote_pipeline_end_to_end() {common::isolate_home(&local_home);build_remote_home(&home);- let store = Arc::new(Store::open(&tmp.path().join("wake.db")).unwrap());+ // Runtime artifacts may live beside transcripts (#47). Leave the socket+ // live during both syncs and give the FIFO no .sock suffix, so the test+ // requires type-based skipping rather than a filename exclusion.+ let socket_rel = ".cursor/projects/runtime/worker.sock";+ let fifo_rel = ".cursor/projects/runtime/events";+ let regular_rel = ".cursor/projects/runtime/regular.sock";+ fs::create_dir_all(home.join(".cursor/projects/runtime")).unwrap();+ let _listener = UnixListener::bind(home.join(socket_rel)).unwrap();+ assert!(std::process::Command::new("mkfifo")+ .arg(home.join(fifo_rel))+ .status()+ .unwrap()+ .success());+ touch(&home.join(regular_rel), "regular file, not a socket\n");++ let local_db_dir = tmp.path().join("long-local-cache-path-".repeat(6));+ fs::create_dir_all(&local_db_dir).unwrap();+ let store = Arc::new(Store::open(&local_db_dir.join("wake.db")).unwrap());store.add_remote_host("devbox").unwrap();store.add_remote_host("down").unwrap();let db_dir = store.db_dir().unwrap();let cache = wake_core::remote::host_cache_dir(&db_dir, "devbox");+ // Exceeds sun_path on both Darwin (104) and Linux (108), even before rsync+ // adds a temporary suffix. Recreating a socket here must never be attempted.+ assert!(cache.join(socket_rel).as_os_str().len() > 108);let devbox = || host_row(&store, "devbox");// ① 首次同步:.copilot(缺父目录)之后的 cursor…dsh 必须到位,exclude 与凭证@@ -144,6 +167,17 @@ fn remote_pipeline_end_to_end() {"探测后消失的源应重探一轮,不是报错");assert!(devbox().last_sync_at.is_some());+ for rel in [socket_rel, fifo_rel] {+ assert!(+ fs::symlink_metadata(cache.join(rel)).is_err(),+ "runtime special file was mirrored: {rel}"+ );+ assert!(fs::symlink_metadata(home.join(rel)).is_ok());+ }+ assert_eq!(+ fs::read_to_string(cache.join(regular_rel)).unwrap(),+ "regular file, not a socket\n"+ );assert!(!cache.join(".local/share/opencode/opencode-next.db")