Skip to content

fix(cli): read node liveness from the recorded node.list fact and drop dead nodes-CLI guards - #124348

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-nodes-cli
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-nodes-cli

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Four nodes-CLI defects found by the round-6 TUI/CLI lane, all in the "stale/multi-signal derivation and dead-end guidance" class:

  1. nodes status --last-connected re-derived a recorded fact and broke for read-scoped callers. The gateway records lastConnectedAtMs on every node.list row (max of stored pairing history and live connection, since 2dcd47d). The CLI ignored it and joined a second pairing-scoped RPC (node.pair.list) — re-implementing the merge worse (preferring stored history over a live connection instead of taking the max) and making the whole command fail for callers whose auth grants operator.read but not operator.pairing, even though the needed fact was already in the response in hand.
  2. nodes list --connected printed "Pending: 0" while requests waited — the filter blanked pending rows and the header then asserted a fact it never checked, in both human and --json output, contradicting nodes pending.
  3. nodes remove/rename carried unreachable guards with wrong advice. resolveCliNodeId throws "node required" on blank input and every parse layer drops id-less rows, so the !nodeId guards were dead — and their text pointed at nodes pending, which lists pairing requests, not the paired nodes these commands target. The reachable empty---name branch now hints at nodes list.
  4. status.node-mode derived node-service liveness from the formatted runtimeShort display string — parsing a fact back out of its own projection; dead in all first-party call paths (both callers pass the runtime object the string is derived from). Field and branch deleted.

Why This Change Was Made

"Record facts where they happen; read them where they are needed" — the --last-connected filter now reads the recorded row fact with connectedAtMs covering gateways that predate it. Pending rows carry no connection state to filter on, so they always show. Dead guards and display-string parsing go per the lean-code doctrine.

User Impact

nodes status --last-connected works for read-scoped callers and no longer under-reports live connections; nodes list --connected stops lying about pending requests; error text points at commands that actually help.

Evidence

  • e2e test updated to pin the single-RPC shape: asserts node.pair.list is not called and the age filter works off node.list rows (the old test cemented the double-RPC join).
  • node scripts/run-vitest.mjs run src/commands/status.node-mode.test.ts src/shared/node-list-parse.test.ts — green; node-mode fixtures now use the production shape (runtime object).
  • pnpm tsgo, pnpm check:test-types, oxfmt/oxlint clean; autoreview clean (0.99).

Production LOC +12/−30 (net −18); tests +14/−16.

…p dead nodes-CLI guards

Four nodes-CLI repairs at their owners:

- nodes status --last-connected joined a second pairing-scoped RPC
  (node.pair.list) to reconstruct last-connection times the gateway already
  records on every node.list row (lastConnectedAtMs, max of stored pairing
  history and live connection, since 2dcd47d). The client-side join also
  preferred stored history over a live connection instead of taking the max,
  and made the command fail for callers whose auth grants operator.read but
  not operator.pairing. The filter now reads the recorded fact;
  connectedAtMs covers gateways predating it.
- nodes list --connected blanked pending rows and then printed "Pending: 0"
  while requests waited — asserting a fact it never checked. Pending rows
  carry no connection state to filter on; they now always show.
- nodes remove/rename carried unreachable !nodeId guards (resolveCliNodeId
  throws "node required" on blank input and every parse layer drops id-less
  rows) whose dead text pointed at the wrong command (nodes pending targets
  pairing requests, not paired nodes). Guards deleted; the reachable empty
  --name branch now hints at nodes list.
- status.node-mode derived node-service liveness from the formatted
  runtimeShort display string — parsing a fact back out of its own
  projection, dead in all first-party call paths (both callers pass the
  runtime object it is derived from). Field and branch deleted.

e2e test updated to pin the single-RPC shape (asserts node.pair.list is NOT
called); node-mode fixtures now use the production shape.
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 16, 2026 02:06
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete merged commit ca84950 into main Aug 16, 2026
247 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/autoqa-nodes-cli branch August 16, 2026 02:19
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…p dead nodes-CLI guards (openclaw#124348)

Four nodes-CLI repairs at their owners:

- nodes status --last-connected joined a second pairing-scoped RPC
  (node.pair.list) to reconstruct last-connection times the gateway already
  records on every node.list row (lastConnectedAtMs, max of stored pairing
  history and live connection, since 0fdab28). The client-side join also
  preferred stored history over a live connection instead of taking the max,
  and made the command fail for callers whose auth grants operator.read but
  not operator.pairing. The filter now reads the recorded fact;
  connectedAtMs covers gateways predating it.
- nodes list --connected blanked pending rows and then printed "Pending: 0"
  while requests waited — asserting a fact it never checked. Pending rows
  carry no connection state to filter on; they now always show.
- nodes remove/rename carried unreachable !nodeId guards (resolveCliNodeId
  throws "node required" on blank input and every parse layer drops id-less
  rows) whose dead text pointed at the wrong command (nodes pending targets
  pairing requests, not paired nodes). Guards deleted; the reachable empty
  --name branch now hints at nodes list.
- status.node-mode derived node-service liveness from the formatted
  runtimeShort display string — parsing a fact back out of its own
  projection, dead in all first-party call paths (both callers pass the
  runtime object it is derived from). Field and branch deleted.

e2e test updated to pin the single-RPC shape (asserts node.pair.list is NOT
called); node-mode fixtures now use the production shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant