diff --git a/crates/maestro-daemon/tests/session_manager.rs b/crates/maestro-daemon/tests/session_manager.rs index 22b7c2d..487d969 100644 --- a/crates/maestro-daemon/tests/session_manager.rs +++ b/crates/maestro-daemon/tests/session_manager.rs @@ -84,6 +84,19 @@ async fn create_rolls_back_tmux_session_when_sidecar_write_fails() { std::fs::create_dir_all(&sidecar_dir).unwrap(); std::fs::set_permissions(&sidecar_dir, std::fs::Permissions::from_mode(0o500)).unwrap(); + // The failure is injected by making the sidecar dir read-only — but root + // bypasses directory permission bits, so the write would succeed and the + // rollback path never trigger. CI runs as root; detect that with a write + // probe and skip rather than report a spurious failure (the rollback is + // still covered in any non-root environment). + let probe = sidecar_dir.join(".perm_probe"); + if std::fs::write(&probe, b"x").is_ok() { + let _ = std::fs::remove_file(&probe); + std::fs::set_permissions(&sidecar_dir, std::fs::Permissions::from_mode(0o700)).unwrap(); + eprintln!("skipping: sidecar dir writable despite 0o500 (running as root?)"); + return; + } + let res = fx .manager .create(CreateSessionRequest {