fix(daemon): surface probe close reasons#56282
Conversation
Greptile SummaryThis PR surfaces immediate WebSocket close reasons (e.g. auth or pairing failures) in
Confidence Score: 5/5Safe to merge — the changes are focused, logically correct, and well-covered by regression tests at both the gateway and CLI layers. No P0 or P1 issues found. The sentinel check (connectLatencyMs == null) correctly distinguishes pre-hello from post-hello closes. The settle() idempotency guard prevents any double-resolution race. The CLI-layer fallback in resolveProbeFailureMessage correctly handles the remaining post-hello timeout+close scenario. All new code paths have corresponding tests. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/gateway/probe.ts | Adds formatProbeCloseError helper and early-settles on pre-hello gateway closes via connectLatencyMs == null guard in onClose — logic is correct and idempotent. |
| src/cli/daemon-cli/probe.ts | Extracts resolveProbeFailureMessage to prefer concrete close reasons over generic timeout strings — correctly handles all error/close combinations. |
| src/gateway/probe.test.ts | Adds startMode/close mock state and a new regression test for pre-hello early-settle; beforeEach resets shared state correctly. |
| src/cli/daemon-cli/probe.test.ts | Adds regression test for timeout-vs-close preference logic in resolveProbeFailureMessage. |
| CHANGELOG.md | Changelog entry correctly added under Unreleased > Fixes. |
Reviews (1): Last reviewed commit: "docs(changelog): note daemon probe close..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c356980aa4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| settle({ | ||
| ok: false, | ||
| connectLatencyMs, | ||
| error: formatProbeCloseError(close), |
There was a problem hiding this comment.
Preserve connect-error detail on early close
The new early-settle branch in probeGateway always reports gateway closed (...) and drops any previously captured connectError, which can hide the actual handshake/auth failure. In the real client flow, GatewayClient calls onConnectError with the detailed failure and may then close with a generic reason like connect failed; with this change, daemon status can regress from actionable text (for example, pairing/auth detail) to a generic close reason. Prefer connectError when it exists (or when the close reason is generic/empty) before formatting the close-only message.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
Summary
timeoutinopenclaw daemon statusUnreleased > FixesWhy
This follows the remaining live review comments from #51087. The lightweight probe path could hide actionable auth or pairing failures behind a timeout, which made
openclaw daemon statusless useful than it should be.Testing
pnpm checkonmb-serverpnpm test -- src/cli/daemon-cli/probe.test.ts src/gateway/probe.test.tsonmb-serverpnpm buildonmb-serverNotes