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:
dasemuandClaude Opus 5.5 committed 2026-11-16 21:59:44 +01:00
1 parent 5f33bb9327
commit 4c355b28ef
4 files changed
+154 -15

No files matched your search

+2 -8
View File
@@ -95,14 +95,8 @@ pub fn connect(cfg: &Config, id: &str) -> Result<Forge> {
/// Git environment for SSH remotes: the user's keys/agent authenticate and nothing prompts.
/// `BatchMode` is only forced when the user has no ssh command of their own.
fn ssh_env() -> Vec<(String, String)> {
let mut env = vec![("GIT_TERMINAL_PROMPT".to_string(), "0".to_string())];
let custom = std::env::var_os("GIT_SSH_COMMAND").is_some()
|| std::env::var_os("GIT_SSH").is_some()
|| std::process::Command::new("git")
.args(["config", "--get", "core.sshCommand"])
.output()
.is_ok_and(|o| o.status.success() && !o.stdout.is_empty());
if !custom {
let mut env = grove_core::git::noninteractive_env();
if !grove_core::git::has_custom_ssh() {
env.push(("GIT_SSH_COMMAND".into(), "ssh -o BatchMode=yes".into()));
}
env