Repository navigation
fix(cli): align nodes list with nodes status by using node.list as primary source - #51051
tomi-claycosmos wants to merge 2 commits into
Conversation
…nfig exists When a user sets models.primary = "ollama/..." without running the provider setup wizard, the provider config entry does not exist in models.providers. The previous resolveSyntheticLocalProviderAuth() returned null early because providerConfig was undefined, causing the auth resolver to throw "No API key found for provider ollama". This regression (v2026.3.13) made it impossible to use Ollama local models via direct config without interactive setup. Fix: check for known local providers (ollama) at the top of the function, before resolving providerConfig. For ollama, return synthetic auth regardless of config state. Fixes: openclaw#50759
There was a problem hiding this comment.
💡 Codex Review
https://github.com/openclaw/openclaw/blob/4afac08ef5aa19769a0e335113f3af0d26fc3529/src/cli/nodes-cli/register.status.ts#L369-L371
Preserve paired-node fields in
nodes list --json
Because filteredPaired now contains NodeListNode objects from node.list, the JSON branch no longer emits the paired-node fields that node.pair.list previously exposed (token, createdAtMs, approvedAtMs, lastConnectedAtMs; see src/shared/node-list-types.ts). Any automation consuming openclaw nodes list --json for approval metadata or reconnect timestamps will silently lose those fields after this change even though pairingResult is still fetched.
ℹ️ 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".
| const filteredPaired = allNodes.filter((node) => { | ||
| // Show nodes that are paired (from node.list paired flag) | ||
| // OR that appear in the pairing registry | ||
| if (!node.paired && !pairedById.has(node.nodeId)) { | ||
| return false; |
There was a problem hiding this comment.
Include node.pair approvals when listing paired nodes
This now builds the paired table only from allNodes returned by node.list, but openclaw nodes approve still writes the separate gateway-owned node-pairing store (approveNodePairing in src/infra/node-pairing.ts) while node.list is populated from device pairing via listDevicePairing() in src/gateway/server-methods/nodes.ts:655. In setups that use node.pair.* without a matching device-pair entry, a request can be approved successfully and then never appear under nodes list, so the command no longer reflects the state managed by nodes pending/approve/reject.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR fixes a real inconsistency in k8s/Docker environments where Key concerns:
Confidence Score: 3/5
|
| const { pending } = parsePairingList(pairingResult); | ||
| const allNodes = parseNodeList(nodeListResult); | ||
| // Build a map of PairedNode data keyed by nodeId for lastConnectedAtMs enrichment | ||
| const pairedById = new Map( | ||
| parsePairingList(pairingResult).paired.map((n) => [n.nodeId, n]), | ||
| ); |
There was a problem hiding this comment.
parsePairingList called twice on the same data
parsePairingList(pairingResult) is called on line 316 to destructure pending, and then called again on line 320 to build pairedById. This double-parses the same result unnecessarily. Combine them into one call:
| const { pending } = parsePairingList(pairingResult); | |
| const allNodes = parseNodeList(nodeListResult); | |
| // Build a map of PairedNode data keyed by nodeId for lastConnectedAtMs enrichment | |
| const pairedById = new Map( | |
| parsePairingList(pairingResult).paired.map((n) => [n.nodeId, n]), | |
| ); | |
| const { pending, paired: pairedList } = parsePairingList(pairingResult); | |
| const allNodes = parseNodeList(nodeListResult); | |
| // Build a map of PairedNode data keyed by nodeId for lastConnectedAtMs enrichment | |
| const pairedById = new Map( | |
| pairedList.map((n) => [n.nodeId, n]), | |
| ); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 316-321
Comment:
**`parsePairingList` called twice on the same data**
`parsePairingList(pairingResult)` is called on line 316 to destructure `pending`, and then called again on line 320 to build `pairedById`. This double-parses the same result unnecessarily. Combine them into one call:
```suggestion
const { pending, paired: pairedList } = parsePairingList(pairingResult);
const allNodes = parseNodeList(nodeListResult);
// Build a map of PairedNode data keyed by nodeId for lastConnectedAtMs enrichment
const pairedById = new Map(
pairedList.map((n) => [n.nodeId, n]),
);
```
How can I resolve this? If you propose a fix, please make it concise.| const pairedRows = filteredPaired.map((n) => { | ||
| const live = connectedById?.get(n.nodeId); | ||
| const pairedData = pairedById.get(n.nodeId); |
There was a problem hiding this comment.
Dead code:
live variable is always identical to n
connectedById is built from allNodes (new Map(allNodes.map((node) => [node.nodeId, node]))), and filteredPaired is a subset of allNodes. Therefore connectedById.get(n.nodeId) will always return n itself. The live variable is also never actually used in the row construction — pairedData has taken over for lastConnectedAtMs. This variable can be removed entirely:
| const pairedRows = filteredPaired.map((n) => { | |
| const live = connectedById?.get(n.nodeId); | |
| const pairedData = pairedById.get(n.nodeId); | |
| const pairedRows = filteredPaired.map((n) => { | |
| const pairedData = pairedById.get(n.nodeId); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 389-391
Comment:
**Dead code: `live` variable is always identical to `n`**
`connectedById` is built from `allNodes` (`new Map(allNodes.map((node) => [node.nodeId, node]))`), and `filteredPaired` is a subset of `allNodes`. Therefore `connectedById.get(n.nodeId)` will always return `n` itself. The `live` variable is also never actually used in the row construction — `pairedData` has taken over for `lastConnectedAtMs`. This variable can be removed entirely:
```suggestion
const pairedRows = filteredPaired.map((n) => {
const pairedData = pairedById.get(n.nodeId);
```
How can I resolve this? If you propose a fix, please make it concise.| // Check for known local providers first — these should always get synthetic auth, | ||
| // even when the user sets models.primary without running the provider setup wizard | ||
| // (i.e., no explicit models.providers.{name} config entry exists). | ||
| const normalizedProvider = normalizeProviderId(params.provider); | ||
| if (normalizedProvider === "ollama") { | ||
| return { | ||
| apiKey: OLLAMA_LOCAL_AUTH_MARKER, | ||
| source: "models.providers.ollama (synthetic local key)", | ||
| mode: "api-key", | ||
| }; | ||
| } |
There was a problem hiding this comment.
Ollama now bypasses explicit
auth override in provider config
By moving the Ollama check before resolveProviderConfig and resolveProviderAuthOverride, this now returns the synthetic key even if the user has explicitly set an auth override (e.g. "token" or "oauth") in their models.providers.ollama config. The old code respected that override by running the Ollama check only after the authOverride !== "api-key" guard.
In practice this is unlikely to matter (no one would configure Ollama with OAuth/token auth), and the comment correctly describes the intent. But if the goal is to handle only the "no explicit config entry at all" case, an explicit cfg null-check guard would make the intent clearer and avoid the silent bypass.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/model-auth.ts
Line: 170-180
Comment:
**Ollama now bypasses explicit `auth` override in provider config**
By moving the Ollama check before `resolveProviderConfig` and `resolveProviderAuthOverride`, this now returns the synthetic key even if the user has explicitly set an `auth` override (e.g. `"token"` or `"oauth"`) in their `models.providers.ollama` config. The old code respected that override by running the Ollama check only after the `authOverride !== "api-key"` guard.
In practice this is unlikely to matter (no one would configure Ollama with OAuth/token auth), and the comment correctly describes the intent. But if the goal is to handle *only* the "no explicit config entry at all" case, an explicit `cfg` null-check guard would make the intent clearer and avoid the silent bypass.
How can I resolve this? If you propose a fix, please make it concise.…ing store inconsistency `nodes list` called node.pair.list as the primary data source, which returns an empty result in environments where the pairing store (file/DB) is not shared between the gateway and the node host (e.g. k8s volumes, Docker). This caused `nodes list` to show 'Paired: 0' while `nodes status` (which calls node.list) correctly showed the paired node. Fix: make `nodes list` use node.list as the authoritative source and node.pair.list as a secondary enrichment source. This aligns both commands to show consistent results regardless of pairing store availability. Fixes: openclaw#50847
4afac08 to
6f42fb1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f42fb105f
ℹ️ 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".
| const [nodeListResult, pairingResult] = await Promise.all([ | ||
| callGatewayCli("node.list", opts, {}), | ||
| callGatewayCli("node.pair.list", opts, {}), | ||
| ]); |
There was a problem hiding this comment.
Keep
nodes list usable with pairing-scoped tokens
Calling both RPCs unconditionally here raises the required scope for plain openclaw nodes list: node.pair.list is in the pairing scope, but node.list is read-scoped in src/gateway/method-scopes.ts. Before this change the unfiltered command could run with a pairing-only token because it only needed node.pair.list; now those operators get a hard node.list authorization failure even when they are only reviewing pending/paired nodes.
Useful? React with 👍 / 👎.
| if (normalizedProvider === "ollama") { | ||
| return { | ||
| apiKey: OLLAMA_LOCAL_AUTH_MARKER, | ||
| source: "models.providers.ollama (synthetic local key)", | ||
| mode: "api-key", |
There was a problem hiding this comment.
Honor non-API-key auth overrides for Ollama
This early return bypasses the later authOverride !== "api-key" guard, so models.providers.ollama.auth = "token" or "oauth" no longer prevents synthetic local auth. In remote Ollama/proxy setups that intentionally require bearer credentials, a missing token now resolves to ollama-local instead of surfacing an auth error, and downstream callers in src/agents/ollama-stream.ts and src/memory/embeddings-ollama.ts will send Authorization: Bearer ollama-local, which breaks those requests with a misleading credential.
Useful? React with 👍 / 👎.
|
Noted. Will address all points: (1) merge duplicate parsePairingList calls, (2) remove the dead live variable, (3) review scope requirement vs nodes status use case to avoid unnecessary scope inflation. |
|
Thanks @tomi-claycosmos for working on this. I am closing this PR as superseded because #72619 has now landed the same nodes list/status fix path with the compatibility safeguards and regression coverage required for the canonical issue #46871. ProjectClownfish could not safely use this branch as the landing path because it mixes the nodes-list change with an unrelated |
Summary
In k8s/Docker environments,
openclaw nodes listshows "Paired: 0" whileopenclaw nodes statuscorrectly shows the paired node. Both commands should be consistent.Root Cause
nodes listcallsnode.pair.list(pairing registry) → returns empty in k8s (volume not shared)nodes statuscallsnode.list(gateway live state) → returns all known nodes correctlyFix
nodes listnow calls bothnode.list(primary) andnode.pair.list(secondary/enrichment) in parallel viaPromise.allnode.listthat havepaired=trueOR appear in the pairing registrylastConnectedAtMsenriched fromnode.pair.listdata when availablenode.list.connectedAtMswhen pairing registry is emptyThis makes
nodes listandnodes statusshow consistent results regardless of whether the pairing store is available.Testing
nodes listnow shows the same nodes asnodes statusin k8snodes list --connectedstill filters correctlynodes list --last-connected 24hstill filters correctlyIssue
Fixes #50847