Repository navigation
fix(cli): keep nodes list aligned with nodes status - #65772
skainguyen1412 wants to merge 5 commits into
Conversation
Greptile SummaryThis PR fixes the source-of-truth mismatch between Confidence Score: 5/5Safe to merge — both findings are P2 style/edge-case concerns that don't block the primary fix. No P0/P1 issues found. The logic is sound and consistent with the existing src/cli/nodes-cli/register.status.ts — the Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 114-125
Comment:
**`"unauthorized"` fallback check is not method-scoped**
`message.includes("unauthorized")` will match any error that contains the word — including a fully-expired or revoked session token. If the gateway returns a generic `"Unauthorized"` for `node.list` for reasons unrelated to scope (e.g., session expiry, some other transient auth rejection), the command silently falls back to `node.pair.list` data and renders it as if it were valid, with no error shown to the user.
The `"missing scope: ..."` branch is precise. The method-not-found branch is also scoped (`message.includes("node.list") && ...`). Making the `"unauthorized"` branch similarly explicit — e.g., requiring `"scope"` or `"node.list"` to co-appear — would reduce the risk of silently swallowing a real auth failure.
```suggestion
function canFallbackToPairingList(err: unknown): boolean {
const message = normalizeLowercaseStringOrEmpty(formatErrorMessage(err));
return (
message.includes("missing scope") ||
(message.includes("unauthorized") &&
(message.includes("scope") || message.includes("node.list"))) ||
(message.includes("node.list") &&
(message.includes("unknown method") ||
message.includes("method not found") ||
message.includes("not implemented") ||
message.includes("unsupported")))
);
}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 349-360
Comment:
**Duplicate `node.list` call in if/else branches**
Both branches call identical `parseNodeList(await callGatewayCli("node.list", opts, {}))` — the only difference is the error-handling policy. This can be collapsed into a single try/catch with the condition inside the catch, removing the duplication and making the policy explicit in one place:
```suggestion
let knownNodes: NodeListNode[] | null = null;
try {
knownNodes = parseNodeList(await callGatewayCli("node.list", opts, {}));
} catch (err) {
if (hasFilters || !canFallbackToPairingList(err)) {
throw err;
}
}
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "CLI: preserve nodes list compatibility c..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ba24c2b9f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The CI/CD failed doesn't related to this PR. |
|
Hi @steipete, could you review this PR? Please feel free to raise any issues if you’d like me to make updates |
|
Codex automated review: keeping this open. Keep open. Current main still has the source-of-truth split this PR targets: Best possible solution: Keep this PR open for maintainer review. The best path is to land this focused CLI fix, or an equivalent change in What I checked:
Remaining risk / open question:
Codex Review notes: model gpt-5.5, reasoning high; reviewed against 9626ef274ae2. |
Summary
openclaw nodes statusused the effectivenode.listview, whileopenclaw nodes liststill used rawnode.pair.list, so the two commands could disagree about which nodes were paired.Paired: 0innodes listeven whennodes statusshowed paired nodes, and scripts consumingnodes list --jsonneeded the existing pairing metadata to remain stable.nodes listnow usesnode.listas the effective paired-node source when available, keepspendingfromnode.pair.list, falls back to pairing-only data for compatibility when unfilterednode.listis unavailable, and preserves raw pairing metadata in--json.node.listbecause they need live node state.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
nodes statusused the newer effective node catalog fromnode.list, whilenodes liststill used the raw node-pairing store fromnode.pair.list.nodes listandnodes statusshould stay aligned, and no test protecting thenodes list --jsonoutput contract.node.lista more accurate effective view of available nodes, butnodes listwas not updated in sync with that behavior.Regression Test Plan (if applicable)
src/cli/program.nodes-basic.e2e.test.tsnodes listshould show effective paired nodes fromnode.list, preserve pairing-only fallback when unfilterednode.listis unavailable, and keep raw pairing metadata in--json.nodes list --connected/nodes status --last-connectedtests covered parts of the command flow, but not the source-of-truth mismatch or JSON compatibility.User-visible / Behavior Changes
openclaw nodes listnow stays aligned withopenclaw nodes statusfor effective paired nodes.openclaw nodes listwithout filters keeps working for pairing-scope callers and older gateways by falling back whennode.listis unavailable.openclaw nodes list --jsonpreserves existing pairing metadata instead of returning a reduced display-only shape.Diagram (if applicable)