fix: report a clear cli error when no herdr server is running - #1963
fix: report a clear cli error when no herdr server is running#1963season179 wants to merge 2 commits into
Conversation
socket cli commands surfaced a raw io::Error debug string
(`Error: Os { code: 2, ... }`) when nothing was listening on the
api socket, which read like a bad --cwd path. map dead-socket
connect failures to a `server_not_running` json error carrying the
resolved socket path, printed once at the edge that surfaces the
error; recovering callers (plugin offline registry fallback, agent
start polling) recognize the marker and keep their existing
behavior.
refs herdrdev#1941
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryMaps dead-socket CLI connect failures to a deferred
Confidence Score: 5/5The PR appears safe to merge; the prior unchecked-path gap is fixed and no blocking failure remains. send_request_unchecked now applies the same dead-server mapping as send_request, so callers get the deferred server_not_running marker; recover paths and single-print edges remain consistent.
|
| Filename | Overview |
|---|---|
| src/cli.rs | Friendly dead-server mapping on both send_request and send_request_unchecked, plus classifier helpers and tests. |
| src/cli/server_not_running.rs | Deferred marker error carrying ErrorResponse, mirroring protocol_guard style without eager print. |
| src/main.rs | Prints carried server_not_running JSON once and exits 1 when the marker reaches main. |
| src/cli/agent.rs | Surfaces deferred server_not_running response instead of a second generic transport line. |
| src/cli/plugin.rs | Treats the marker as a connection error so offline registry fallback still prints nothing. |
| src/cli/status.rs | Uses shared server_not_running_error classifier; not-running status path unchanged in behavior. |
Reviews (2): Last reviewed commit: "fix: map dead-socket errors on the unche..." | Re-trigger Greptile
Current behavior
With no herdr server running, every socket CLI command fails with a raw debug string:
It reads like the
--cwdpath is invalid, which is exactly how #1941 was reported. A stale socket file (ConnectionRefused) and every other workspace/tab/pane/agent/worktree command produce the same raw output.What this does
Dead-socket connect failures from the guarded CLI request path (
ErrorKind::NotFound | ConnectionRefused— kind-based so Windows named pipes classify the same) map to a marker error carrying aserver_not_runningErrorResponse, mirroring the existingprotocol_guardpattern. The edge that surfaces the error prints it exactly once:Exit codes are unchanged (server errors 1, syntax errors 2). Printing is deferred — the marker carries the response — so callers that intentionally recover from a dead server keep their behavior with nothing printed:
plugin list --json→ offline result, exit 0, empty stderr)herdr statusstill reportsstatus: not runningagent starttransport failures print exactly one error linesession stopmessaging unchangedThe shared classifier replaces the private copy in
cli/status.rs. No wire protocol change (CLI-emitted error, likeprotocol_mismatch) and no server auto-start behavior.Validation
just checkgreen on macOS (zig 0.15.2 via homebrew) except one pre-existing failure unrelated to this change:live_handoff_keeps_unmanaged_agent_name_bound_to_saved_sessionfails identically on clean master @ 1491b7dstatusgraceful; positive path against a live server unchanged; plugin offline fallback behavior identical to v0.7.5refs #1941