fix(broker): log the whole error chain when a worker fails to spawn

Merged
KH
3d ago
+22-2

Why

On fleet node sf-frame, claude spawns fail with only failed to spawn worker about 5ms after start (crates/broker/src/worker.rs:1670, command.spawn().context("failed to spawn worker")). Example from sf-frame.log.2026-10-12:

2026-10-12T21:41:45.003167Z ERROR relay_broker::runtime::relaycast_events: failed to spawn worker via relaycast WS child=e2e-d1fix-sfframe-1 error=failed to spawn worker

relaycast_events.rs logged the anyhow::Error with Display (%e), which prints only the outermost context. The OS error that explains the failure (for example No such file or directory) was dropped. The fleet action.result already uses {error:#}, but on that node those results are rejected with d1_pressure, so the log line is the only place the cause would appear.

Change

The log line and the eprintln! now use {:#}, through a spawn_failure_detail helper. This changes log output only. Behaviour is unchanged.

Verification

$ cargo test -p agent-relay-broker --lib spawn_failure_detail
test runtime::relaycast_events::tests::spawn_failure_detail_keeps_the_os_error ... ok
test result: ok. 1 passed; 0 failed; ...

Mutation check. I changed the helper to format!("{error}"):

test runtime::relaycast_events::tests::spawn_failure_detail_keeps_the_os_error ... FAILED
test result: FAILED. 0 passed; 1 failed; ...

After restoring it (cmp identical), the test passes again. cargo fmt --check and cargo clippy -p agent-relay-broker --lib -- -D warnings are clean.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


[!NOTE]
Low Risk
Logging-only change in one error path; no spawn, dispatch, or control-plane behavior is modified.

Overview
Relaycast WebSocket worker spawn failures now log the full anyhow error chain instead of only the outer context string failed to spawn worker.

The tracing::error! line and matching eprintln! in relaycast_events.rs go through a small spawn_failure_detail helper that formats with {:#}, so operators see underlying causes (for example a missing binary / NotFound) when fleet action results are unavailable. Spawn behavior and error propagation are unchanged.

CHANGELOG documents the fix under Fixed.

Reviewed by Cursor Bugbot for commit aca562f7d12e8bc7f87e98c0250868c1bb43f53f. Bugbot is set up for automated code reviews on this repo. Configure here.


Agent Relay sessions

  • claude session a8232a06 · opened via gh pr create · last active 2026-10-13