daemon status --json reports runtime.status=stopped while port 18789 still has a listener (split-brain)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8.7k
- Forks
- 1.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 253
Description
Summary
openclaw daemon status --json reports runtime.status=stopped even when port 18789 has an active listener owned by a previous gateway instance. The status reporter is reading service-registration state and not cross-checking the actual port owner, so it lies in any split-brain scenario.
Repro
Easiest path is via the companion bug (#979 — gateway install --force not idempotent):
- Have a healthy gateway running and listening on 18789
- Run
openclaw gateway install --force→ second instance fails withEADDRINUSE, but the first instance keeps running - Run
openclaw daemon status --json
Observed
{ \"runtime\": { \"status\": \"stopped\" }, ... }
…while netstat -ano | findstr 18789 shows the original node.exe still listening.
Expected
The status reporter should cross-check:
- Is port 18789 currently bound? (if yes, by which PID?)
- Is the bound PID one of our managed gateway instances?
Possible reported states:
| Port listener | Service registration | runtime.status |
|---|---|---|
| ours (matches registration) | matches | running |
| no listener | absent | stopped |
| listener exists, registration absent or mismatched | — | conflict (new) — include the offending PID |
| no listener but registration present | — | stale (new) |
At minimum, conflict is needed so downstream tooling can distinguish "daemon is genuinely down" from "daemon is in split-brain after a botched install".
Impact
Discovered during downstream verification (anro-claw issue #825). Downstream L2 acceptance tests trust daemon status --json as the ground-truth health probe — when it lies, real env state gets mis-framed as a regression. We currently work around it by checking netstat 18789 directly, but that's not portable and shouldn't be necessary.
Environment
- Windows 11, Node 20 (bundled)
- Observed on 5060Ti, 2026-04-26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the implementation of openclaw daemon status --json and reproduce the split-brain case with a listener on port 18789. Trace how service-registration state is read and how the port owner is detected across the stated Windows environment. Done means the JSON distinguishes running, stopped, conflict with the offending PID, and stale as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100