Give remote daemon unavailability a typed refusal reason

Merged
TH
3h ago
+174-5

Summary

  • When the client refuses a command because the remote daemon cannot be reached, the error now carries details.reason: 'remote_daemon_unavailable' and details.dispatched: 'no', so scripts and agents can branch on the code instead of the message text. --json prints both fields in the error envelope.
  • Both refusal sites โ€” the pre-dispatch ensureRemoteDaemon health check and the restart probe after an instance mismatch โ€” now share one error constructor in the daemon lifecycle error module, so they cannot drift apart. The error code stays COMMAND_FAILED and the existing message text is unchanged.
  • The published refusal list in the commands doc gains the new reason.

Validation

  • Base ddbfc85566, head 631e42647b.
  • pnpm check:affected --run --head HEAD passed (exactCommit: true): format, lint, typecheck, layering, fallow, build, vitest-related, unit, daemon-wire-compat, command-docs, docs-links, docs-prose. Replay/web and device lanes stay GitHub-authoritative.
  • New tests cover the pre-dispatch probe refusal, the restart-probe refusal, and the --json error envelope; existing tests that assert the message text are unchanged.
  • The diff was re-read cold before submit; no independent reviewer ran locally.

๐Ÿค– Generated with Claude Code


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