mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 15:26:09 +00:00
fix(daemon): never block the sync loop on a prompt or a stuck git call
The daemon inherited the desktop session's SSH_ASKPASS (ksshaskpass), so an ssh passphrase/host-key prompt opened a dialog nobody answered, and git had no time limit: the single sync loop stalled for 1.5 h and repos migrated meanwhile were never picked up. - groved sets a non-interactive git env (no terminal/askpass prompts, HTTP low-speed abort) and leaves the ssh command to the user/repo. - Git calls get an optional wall-clock limit (daemon: 900 s); on expiry the whole process group (git, ssh, helpers) is killed. - Secret Service lookups time out like the forge CLIs (locked keyring). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f33bb9327
commit
4c355b28ef
4 files changed
+154
-15
No files matched your search
@@ -5,6 +5,9 @@ use grove_core::config::Config;
|
||||
use grove_daemon::{Daemon, Settings};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Upper bound for one git call of the daemon (a large first fetch included).
|
||||
const GIT_TIMEOUT_SECS: u64 = 900;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let mut config: Option<PathBuf> = None;
|
||||
@@ -23,6 +26,13 @@ fn main() -> Result<()> {
|
||||
.context("cannot determine config path")?;
|
||||
let cfg = Config::load(&path)?;
|
||||
grove_core::snapshot::set_max_file_bytes(cfg.sync.max_file_mb * 1024 * 1024);
|
||||
// Unattended: git/ssh must never prompt (the session's SSH_ASKPASS would open a dialog and
|
||||
// block every sync), and no git call may block the sync loop forever.
|
||||
for (k, v) in grove_core::git::noninteractive_env() {
|
||||
// SAFETY: still single-threaded; no other thread reads the environment yet.
|
||||
unsafe { std::env::set_var(k, v) };
|
||||
}
|
||||
grove_core::git::set_timeout(GIT_TIMEOUT_SECS);
|
||||
let st = Settings::standard();
|
||||
eprintln!(
|
||||
"groved: machine {:?}, root {}, socket {}",
|
||||
|
||||
Reference in new issue
Block a user