#22341: fix(status): detect node-only mode and show remote gateway info
commands
size: S
Cluster:
Node and macOS Enhancements
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
#6064: fix(daemon): prefer bundled node from install-cli.sh over system node
by joyshmitz · 2026-02-01
80.2%
#18112: fix(daemon): gateway install on macOS ignores fnm/nvm node (#18090)
by yinghaosang · 2026-02-16
77.7%
#11455: fix(gateway): default gateway.mode to local when unset
by AnonO6 · 2026-02-07
76.0%
#17835: Fix misleading gateway stop hints for standalone listeners
by ConnorCallison · 2026-02-16
75.9%
#11147: fix(daemon): stop gateway by port when no daemon service is active
by jasonthewhale · 2026-02-07
75.4%
#23113: fix: show actual runtime version after update/restart when service ...
by BryanTegomoh · 2026-02-22
74.7%
#23584: fix(daemon): improve gateway service detection to avoid false posit...
by mohandshamada · 2026-02-22
74.4%
#21635: Fix status --deep showing tailscale off while tailnet is active
by graysurf · 2026-02-20
74.3%
#23666: fix(doctor): openclaw-browser.service falsely flagged as duplicate ...
by yinghaosang · 2026-02-22
74.2%
#22716: fix: gateway status probe uses wss:// when TLS enabled; accept self...
by Fratua · 2026-02-21
73.9%