Give remote daemon unavailability a typed refusal reason
Merged
TH
3h ago+174+174+012345678901234567890123456789-5-5-0123456789
Summary
- When the client refuses a command because the remote daemon cannot be reached, the error now carries
details.reason: 'remote_daemon_unavailable'anddetails.dispatched: 'no', so scripts and agents can branch on the code instead of the message text.--jsonprints both fields in the error envelope. - Both refusal sites โ the pre-dispatch
ensureRemoteDaemonhealth 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 staysCOMMAND_FAILEDand the existing message text is unchanged. - The published refusal list in the commands doc gains the new reason.
Validation
- Base
ddbfc85566, head631e42647b. pnpm check:affected --run --head HEADpassed (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
--jsonerror 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](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.