Skip to content

CLI: include connected nodes in nodes list - #50871

Closed
KevinSailema wants to merge 9 commits into
openclaw:mainfrom
KevinSailema:fix/nodes-list-connected-50847
Closed

KevinSailema wants to merge 9 commits into
openclaw:mainfrom
KevinSailema:fix/nodes-list-connected-50847

Conversation

@KevinSailema

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: openclaw nodes list relied on node.pair.list as its primary source, so active connected nodes could be missing from the rendered list when pair data was incomplete/stale.
  • Why it matters: Users could see Connected: 1 in nodes status but not see that node in nodes list, causing confusing and inconsistent operational output.
  • What changed: nodes list now merges live state from node.list, includes nodes in paired or connected states, preserves existing table format, and computes Pending/Paired counts from actual state. Added regression coverage in program.nodes-basic.e2e.test.ts.
  • What did NOT change (scope boundary): No gateway RPC contract changes, no dependency/package updates, no docs/config/env/schema changes, and no behavior changes outside nodes list/nodes status CLI surface.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • openclaw nodes list now includes nodes that are currently connected even when node.pair.list does not contain them.
  • Pending and Paired summary counts now reflect actual runtime node states used for rendering.
  • None (no config/default changes).

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation: None

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22+ with pnpm
  • Model/provider: N/A
  • Integration/channel (if any): CLI nodes commands
  • Relevant config (redacted): default local dev config

Steps

  1. Prepare gateway responses where node.pair.list has no paired entry for an active node.
  2. Run openclaw nodes list.
  3. Compare with openclaw nodes status output showing connected node(s).

Expected

  • nodes list includes nodes in paired or connected states, and summary counts match rendered states.

Actual

  • Before fix: connected node could be missing from nodes list while nodes status reported it as connected.
  • After fix: connected node is included and counts are consistent.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Ran targeted test pnpm test -- src/cli/program.nodes-basic.e2e.test.ts and confirmed new regression case; ran full quality gate pnpm check.
  • Edge cases checked: --connected and --last-connected filters still work with merged live/pair data; display fallback for node name/IP remains stable.
  • What you did not verify: Live manual run against a real remote node fleet in production-like environment.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps: None

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert commit 7bf1afa3b from this PR branch.
  • Files/config to restore: register.status.ts and program.nodes-basic.e2e.test.ts
  • Known bad symptoms reviewers should watch for: nodes list omits connected nodes again or Paired/Pending counts diverge from table rows.

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: Mixed/incomplete data between node.list and node.pair.list could produce unexpected label/count combinations.
    • Mitigation: Explicit merge/fallback logic and regression test coverage for the reported inconsistency case.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Mar 20, 2026
@greptile-apps

greptile-apps Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a real inconsistency where openclaw nodes list could omit actively-connected nodes because it relied solely on node.pair.list as its data source. The fix merges live data from node.list into the candidates set so that nodes in paired or connected state are always included, and updates the summary header to include a Connected: N count alongside Paired: N.

All four issues raised in the previous review round have been resolved:

  • liveById / redundant map lookup → removed entirely
  • Auth errors (unauthorized, forbidden, missing scope) silently falling back to pair-list data → now surfaced via shouldFallbackToPairList
  • Connected-only nodes unaccounted in summary counts → Connected: N added to the header
  • Empty displayName bypassing the fallback chain via ?? → replaced with || which treats "" as falsy

Minor observation (not blocking): shouldFallbackToPairList requires the literal string "node.list" to appear in the error message in addition to a known method-not-found keyword. A gateway that emits a generic "unknown method" or "unsupported" without naming the specific RPC method will cause nodes list to throw rather than degrade gracefully. This is intentionally conservative (avoids misclassifying application errors as version-compat fallbacks), but it is worth documenting so future callers know why the fallback does not trigger in that scenario.

Test coverage: Five new E2E cases cover the primary bug, old-gateway fallback, --json schema preservation, paired-only-from-node.list, and auth-error surfacing. The existing --connected filter test continues to pass with the new merge logic.

Confidence Score: 4/5

  • Safe to merge — bug fix is scoped to the CLI nodes list command, all prior review concerns are addressed, and regression tests are solid.
  • The logic change is well-contained: live data is merged via pairedById cross-reference, the fallback path is guarded conservatively, and display-name/count bugs from the prior round are cleanly fixed. The one remaining concern (fallback not triggering for generic method-not-found errors without "node.list" in the message) is a deliberate design choice that avoids false positives, not a latent bug. Test coverage for the new paths is comprehensive.
  • No files require special attention.

Last reviewed commit: "CLI: stabilize nodes..."

Comment thread src/cli/nodes-cli/register.status.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bf1afa3b4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38cd5a5f64

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f38a69b5f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved
Comment thread src/cli/nodes-cli/register.status.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b915c3fcaf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/nodes-cli/register.status.ts Resolved
@KevinSailema

Copy link
Copy Markdown
Author

@greptile-apps please review the latest commits and provide an updated summary.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d9fc52f0f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/cli/nodes-cli/register.status.ts Resolved
@KevinSailema

Copy link
Copy Markdown
Author

@greptile-apps please review the latest commits and provide an updated summary.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 467a1b2ec7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +362 to +363
try {
nodes = parseNodeList(await callGatewayCli("node.list", opts, {}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Merge pair-list rows instead of overwriting them with node.list

Nodes approved through the existing nodes approve flow can disappear from nodes list once they disconnect, because this assignment replaces the node.pair.list seed with node.list rows instead of merging them. openclaw nodes approve still calls node.pair.approve (src/cli/nodes-cli/register.pairing.ts:45-53), and the gateway backs node.pair.list with listNodePairing() while node.list reads listDevicePairing() plus live sessions (src/gateway/server-methods/nodes.ts:538 and src/gateway/server-methods/nodes.ts:655-679). Any node that exists only in the node-pairing store—especially a previously approved but currently disconnected node—was shown before this change and is now silently dropped.

Useful? React with 👍 / 👎.

Comment on lines +359 to +360
connected: false,
paired: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't fabricate offline state in the legacy node.list fallback

When the compatibility fallback runs, these seeded rows are hard-coded as connected: false, but node.pair.list does not carry live connectivity at all; it only stores pairing metadata like lastConnectedAtMs (src/infra/node-pairing.ts:35-46). On gateways old enough to lack node.list, the new output therefore reports Connected: 0 and emits connected: [] even if some paired nodes are actually online. Since this branch exists specifically to support older gateways, turning “unknown” into “offline” is misleading for both operators and JSON consumers.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the channel: signal Channel integration: signal label Mar 20, 2026
@clawsweeper

clawsweeper Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Closing this as duplicate or superseded after Codex automated review.

PR #50871 should close as superseded. Current main still has the underlying nodes-list/nodes-status mismatch, but the same remaining work is now tracked by the open canonical issue #46871 and the newer open PR #65772, which targets the same CLI surface with a narrower two-file change and compatibility-focused tests. This older branch is dirty and carries unrelated Signal test-harness churn plus unresolved final review feedback on the same implementation area.

Best possible solution:

Close #50871 as superseded, keep #46871 and #65772 as the active path, and land a narrow CLI fix that aligns nodes list with the effective node.list paired-node view while preserving pairing-scope fallback behavior and the existing nodes list --json pairing metadata contract.

What I checked:

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against 76cf013df507.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal cli CLI command changes size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect behavious of commands openclaw nodes list and openclaw nodes status

1 participant