← Back to PRs

#22341: fix(status): detect node-only mode and show remote gateway info

by therk open 2026-02-21 02:06 View on GitHub →
commands size: S
Fixes #17271 ## Problem On a machine configured as a **node** (no local gateway), `openclaw status` showed: ``` Gateway: local · 127.0.0.1:18789 · unreachable (connect ECONNREFUSED 127.0.0.1:18789) ``` This is misleading — the node service is working correctly and connected to a remote gateway, but the output implies something is broken with no indication of node-only mode. ## Changes **`src/commands/status.daemon.ts`** - Exposed `loaded` field in `DaemonStatusSummary` (previously only `loadedText` was available) so callers can check service state directly **`src/commands/status.command.ts`** - Imported `loadNodeHostConfig` from `node-host/config` to read the node's remote gateway address from `node.json` - Added `isNodeOnlyMode` detection: node service installed+loaded AND gateway service not installed (`daemon.installed === false`) - In `gatewayValue` display: when in node-only mode, shows `node → <host>:<port> · node service running` instead of the ECONNREFUSED error **`src/commands/status-all.ts`** - Same `isNodeOnlyMode` detection and `loadNodeHostConfig` integration for `openclaw status --all` - Overrides the gateway health error block with a node-mode summary when applicable **`src/commands/status.e2e.test.ts`** - Promoted `resolveGatewayService` mock to a `vi.fn()` in the hoisted mock block (enables per-test override) - Added test: when node service is loaded and gateway service is not installed, output contains `node →` and does **not** contain `unreachable` ## Example output after fix (Mac Studio / node-only machine) ``` Gateway node → spark.tail170cfb.ts.net:18789 · node service running ``` ## Test results - `pnpm build`: ✅ clean - `vitest run status.e2e.test.ts`: ✅ 8/8 passing (including new test) - Pre-existing failure in `auto-reply/status.test.ts` confirmed on `main` — unrelated <!-- greptile_comment --> <h3>Greptile Summary</h3> Added detection for node-only mode (when only the node service is running without a local gateway) and updated the status output to show the remote gateway address instead of misleading ECONNREFUSED errors. Key changes: - Exposed `loaded` field in `DaemonStatusSummary` to enable direct service state checking - Added `isNodeOnlyMode` detection logic in both `status.command.ts` and `status-all.ts` - When in node-only mode, displays `node → <host>:<port> · node service running` instead of error messages - Added test coverage for the node-only mode scenario The implementation correctly addresses the issue described in #17271 by providing clear feedback when running in node-only mode. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minor inconsistency noted - The implementation correctly solves the stated problem and includes test coverage. One logic inconsistency exists between `status.command.ts` and `status-all.ts` in how they detect if the node service is loaded, but this is unlikely to cause issues in practice since running services typically have both status and pid fields. The changes are well-contained and the test validates the expected behavior. - Pay attention to `src/commands/status.command.ts` line 223-226 for the noted inconsistency <sub>Last reviewed commit: 5c96969</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs