From 8d72907b0537840e10b9d8f713a19e9f6d483a53 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Wed, 2 Dec 2026 18:37:31 +0100 Subject: [PATCH] fix(daemon): say why a run failed, not only how many did MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A lane pass logged "N handled, M failed" and the interactive drain logged how many runs it emptied, both without the reason. A run that dies is the one thing an operator has to see, and its only trace is the reason the driver recorded: a checkpoint refused by a dead lease, a provider hanging up, a panicking handler. The count alone reads as noise next to the tick logs, and a chat turn that failed without a line looks exactly like a slow model. Both paths print the reason now. `Outcome` carries no key, so the warning names the lane and quotes what the run said — a handler's own failure names its key. --- crates/rhema-claw/src/daemon.rs | 41 ++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/crates/rhema-claw/src/daemon.rs b/crates/rhema-claw/src/daemon.rs index 45ebb98..33ba1d5 100644 --- a/crates/rhema-claw/src/daemon.rs +++ b/crates/rhema-claw/src/daemon.rs @@ -182,12 +182,24 @@ fn spawn_pass(driver: Arc, label: &'static str, busy: Arc) { .iter() .filter(|outcome| matches!(outcome, Outcome::Handled)) .count(); - let failed = outcomes + let failures: Vec<&String> = outcomes .iter() - .filter(|outcome| matches!(outcome, Outcome::Failed(_))) - .count(); - if handled + failed > 0 { - eprintln!("[claw] {label} pass: {handled} handled, {failed} failed"); + .filter_map(|outcome| match outcome { + Outcome::Failed(reason) => Some(reason), + _ => None, + }) + .collect(); + if handled + failures.len() > 0 { + eprintln!( + "[claw] {label} pass: {handled} handled, {} failed", + failures.len() + ); + } + // The count alone says a run died and not why: a + // checkpoint refused by a dead lease reads the same as a + // provider hanging up. The reason is the only trace. + for reason in failures { + eprintln!("[claw] warning: a {label} run failed: {reason}"); } } Err(err) => eprintln!("[claw] warning: {label} pass failed: {err}"), @@ -751,7 +763,24 @@ impl Daemon { async fn drain_interactive(&self) { match self.interactive_driver.run_once().await { Ok(runs) if !runs.is_empty() => { - eprintln!("[claw] interactive: {} queued run(s) drained", runs.len()); + let failures: Vec<&String> = runs + .iter() + .filter_map(|outcome| match outcome { + Outcome::Failed(reason) => Some(reason), + _ => None, + }) + .collect(); + eprintln!( + "[claw] interactive: {} queued run(s) drained, {} failed", + runs.len(), + failures.len() + ); + // Same rule as the lanes: a failed run's only trace is + // the reason the handler gave, and a chat turn that + // died without one looks exactly like a slow model. + for reason in failures { + eprintln!("[claw] warning: an interactive run failed: {reason}"); + } } Ok(_) => {} Err(err) => eprintln!("[claw] warning: interactive pass failed: {err}"),