fix(gateway): distinguish reachable gateway from failed status probe#98183
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 7:59 PM ET / 23:59 UTC. Summary PR surface: Source +21, Tests +158. Total +179 across 2 files. Reproducibility: yes. by source inspection: current main unconditionally prints the warm-up hint for a failed RPC probe while the loaded service runtime is running. The stale-PID edge case is also source-reproducible because restart health can be healthy while stale gateway PIDs remain non-empty. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the renderer-only diagnostic change after ordinary maintainer review and CI, keeping health computation, RPC probing, service management, config, and defaults unchanged. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main unconditionally prints the warm-up hint for a failed RPC probe while the loaded service runtime is running. The stale-PID edge case is also source-reproducible because restart health can be healthy while stale gateway PIDs remain non-empty. Is this the best way to solve the issue? Yes. The renderer is the narrow owner for this operator-facing wording, and the PR uses existing restart-health fields while preserving warm-up behavior for stale, unhealthy, and unknown health states. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e50f41dd6ea. Label changesLabel justifications:
Evidence reviewedPR surface: Source +21, Tests +158. Total +179 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
0dec0a7 to
7fbaef0
Compare
… PIDs inspectGatewayRestart can set health.healthy from bare reachability after ownership attribution failed, while still returning a non-empty staleGatewayPids. Printing owns-port recovery guidance in that case contradicted the dedicated stale-PID diagnostic below it. Require staleGatewayPids to be empty before treating healthy as owns-port proof.
|
Merged via squash.
|
* origin/main: test(gateway): isolate live release agent state test(plugins): repair prerelease validation fixtures fix(discord): guard JSON.parse against malformed API response bodies (#97889) fix(codex): preserve app approvals in side forks (#98812) fix(agents): don't inject A2A turns into isolated-cron sessions_send (#92257) (#92283) fix(browser): guard setDeep against empty keys array (#98138) docs(telegram): move maintainer decisions into scoped AGENTS.md fix(ios): generate light app store screenshots only fix(gateway): distinguish reachable gateway from failed status probe (#98183)
…penclaw#98183) * fix(gateway): distinguish reachable gateway from failed status probe * fix(status): gate owns-port RPC recovery guidance on no stale gateway PIDs inspectGatewayRestart can set health.healthy from bare reachability after ownership attribution failed, while still returning a non-empty staleGatewayPids. Printing owns-port recovery guidance in that case contradicted the dedicated stale-PID diagnostic below it. Require staleGatewayPids to be empty before treating healthy as owns-port proof.
What Problem This Solves
openclaw gateway statusprintsWarm-up: launch agents can take a few seconds. Try again shortly.whenever the RPC probe fails while the managed service is loaded and running — even when the gateway process is up and owns its port and the probe is failing for an unrelated reason such as a wrong probe auth token or bad config.In that state the gateway is clearly not "warming up", so telling the operator to wait and retry is the wrong nudge — they should be checking the probe credentials/config (or restarting if the gateway is wedged). This follows the same status-distinction lineage as the recent
/statusslices (#97479, #97878).Why This Change Was Made
Deep status already computes
status.health.healthy, which isrunning && owns-the-listening-port(it is not a reachability proof). When that is true and the RPC probe still fails, it is an unambiguous "not warm-up" signal, so the message changes from warm-up to recovery guidance. Everything else keeps the existing warm-up message:health.healthy === true: the gateway process is running and owns the port, so a failed probe is not a warm-up delay. The cause is probe credentials/config or a wedged gateway (a wedged gateway that still owns the port is also reported ashealthy === true), so we point the operator at both paths without asserting a single cause.health.healthy === falseis deliberately not redirected — it is ambiguous (a just-started gateway reportsfalseuntil it binds the port; the port may be held by a foreign process; or a stale gateway PID may own it), and those cases are already covered by the dedicated stale-PID, "port not listening", and port-conflict diagnostics elsewhere in the status output. Unknown health (shallow status) also keeps warm-up.This is presentation-only. Health computation, probe behavior, service-manager behavior, config, and RPC are untouched; no new config/default surfaces, no new imports.
User Impact
When the RPC probe fails on a running service whose gateway owns the port,
openclaw gateway statusnow prints:instead of the generic warm-up line. All other states (gateway still starting up, port held by another process, stale PID, or unknown health) keep the existing warm-up message and the existing dedicated diagnostics. No behavior change beyond the printed guidance text.
Evidence
pnpm test src/cli/daemon-cli/status.print.test.ts→ 20 passed (17 existing + 3 new):health.healthy:true+ failed probe + running → owns-port "not a warm-up delay" guidance, no warm-up line.health.healthy:false+ port busy + running → warm-up line preserved, no "Gateway process is …" guidance (guards against misfiring restart guidance on a foreign port conflict).health→ existing warm-up line preserved, no "Gateway process is …" line.pnpm tsgo:coreandpnpm tsgo:test:srcclean. Format:oxfmt --checkclean.printDaemonStatus(no mocks; real CLI status styles, realformatCliCommand, real runtime) with a constructedDaemonStatusper case. This exercises the changed render path, not gather/deep status (which is unchanged). Excerpted output (surrounding status lines omitted):