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

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 #1941

* fix: map dead-socket errors on the unchecked cli request path

refs #1941

* fix: make server-not-running guidance session-aware

refs #1941
This commit is contained in:
Season Saw
2026-08-01 16:17:23 +03:00
committed by GitHub
parent 26a7bc860e
commit f99647b2c2
7 changed files with 255 additions and 20 deletions
+13 -8
View File
@@ -1618,14 +1618,19 @@ fn current_unix_ms() -> u64 {
}
fn is_connection_error(err: &std::io::Error) -> bool {
matches!(
err.kind(),
std::io::ErrorKind::NotFound
| std::io::ErrorKind::ConnectionRefused
| std::io::ErrorKind::ConnectionAborted
| std::io::ErrorKind::ConnectionReset
| std::io::ErrorKind::BrokenPipe
)
// A `server_not_running` marker is a connect failure for recovery purposes:
// treating it as a connection error lets plugin commands fall back to the
// offline registry. The marker carries (but does not print) a friendly
// response, so recovering here prints nothing.
super::server_not_running_was_reported(err)
|| matches!(
err.kind(),
std::io::ErrorKind::NotFound
| std::io::ErrorKind::ConnectionRefused
| std::io::ErrorKind::ConnectionAborted
| std::io::ErrorKind::ConnectionReset
| std::io::ErrorKind::BrokenPipe
)
}
fn print_plugin_response(method: Method) -> std::io::Result<i32> {