Repository navigation
fix(gateway): reject list and status as invalid model refs (#51126) - #51027
Yaohua-Leo wants to merge 14 commits into
Conversation
Greptile SummaryThis PR aligns
Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 345
Comment:
**Redundant `parseNodeList` call**
`parseNodeList(nodeListResult)` is called twice — once on line 315 to build `liveNodesById`, and again on line 345 to produce `liveNodes`. Since `liveNodesById` already holds all the same data, `liveNodes` can simply be derived from the existing map to avoid re-parsing:
```suggestion
const liveNodes = Array.from(liveNodesById.values());
```
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: 348-349
Comment:
**Misleading `(of N)` label when no filters are active**
The previous code only showed the `(of N)` label when `hasFilters` was true — i.e., when `--connected` or `--last-connected` flags were passed. The new code drops that guard, so when `node.pair.list` returns an empty `paired` array but `node.list` reports paired nodes, the output becomes:
```
Pending: 0 · Paired: 0 (of 5)
```
This is misleading because the `(of N)` suffix is conventionally read as "N items exist, but they were filtered down to the displayed count." Here, there's no active filter — the two sources simply disagree. Without the `hasFilters` guard the label appears even on an unfiltered invocation, confusing users into thinking a filter removed entries.
Consider re-introducing the `hasFilters` guard so the label is only shown when filters are actually reducing the results:
```suggestion
const hasFilters = connectedOnly || sinceMs !== undefined;
const filteredLabel =
hasFilters && filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : "";
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: "fix(cli): align node..." |
| return true; | ||
| }); | ||
|
|
||
| const liveNodes = parseNodeList(nodeListResult); |
There was a problem hiding this comment.
parseNodeList(nodeListResult) is called twice — once on line 315 to build liveNodesById, and again on line 345 to produce liveNodes. Since liveNodesById already holds all the same data, liveNodes can simply be derived from the existing map to avoid re-parsing:
| const liveNodes = parseNodeList(nodeListResult); | |
| const liveNodes = Array.from(liveNodesById.values()); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 345
Comment:
**Redundant `parseNodeList` call**
`parseNodeList(nodeListResult)` is called twice — once on line 315 to build `liveNodesById`, and again on line 345 to produce `liveNodes`. Since `liveNodesById` already holds all the same data, `liveNodes` can simply be derived from the existing map to avoid re-parsing:
```suggestion
const liveNodes = Array.from(liveNodesById.values());
```
How can I resolve this? If you propose a fix, please make it concise.| const filteredLabel = | ||
| hasFilters && filteredPaired.length !== paired.length ? ` (of ${paired.length})` : ""; | ||
| filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : ""; |
There was a problem hiding this comment.
Misleading
(of N) label when no filters are active
The previous code only showed the (of N) label when hasFilters was true — i.e., when --connected or --last-connected flags were passed. The new code drops that guard, so when node.pair.list returns an empty paired array but node.list reports paired nodes, the output becomes:
Pending: 0 · Paired: 0 (of 5)
This is misleading because the (of N) suffix is conventionally read as "N items exist, but they were filtered down to the displayed count." Here, there's no active filter — the two sources simply disagree. Without the hasFilters guard the label appears even on an unfiltered invocation, confusing users into thinking a filter removed entries.
Consider re-introducing the hasFilters guard so the label is only shown when filters are actually reducing the results:
| const filteredLabel = | |
| hasFilters && filteredPaired.length !== paired.length ? ` (of ${paired.length})` : ""; | |
| filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : ""; | |
| const hasFilters = connectedOnly || sinceMs !== undefined; | |
| const filteredLabel = | |
| hasFilters && filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : ""; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cli/nodes-cli/register.status.ts
Line: 348-349
Comment:
**Misleading `(of N)` label when no filters are active**
The previous code only showed the `(of N)` label when `hasFilters` was true — i.e., when `--connected` or `--last-connected` flags were passed. The new code drops that guard, so when `node.pair.list` returns an empty `paired` array but `node.list` reports paired nodes, the output becomes:
```
Pending: 0 · Paired: 0 (of 5)
```
This is misleading because the `(of N)` suffix is conventionally read as "N items exist, but they were filtered down to the displayed count." Here, there's no active filter — the two sources simply disagree. Without the `hasFilters` guard the label appears even on an unfiltered invocation, confusing users into thinking a filter removed entries.
Consider re-introducing the `hasFilters` guard so the label is only shown when filters are actually reducing the results:
```suggestion
const hasFilters = connectedOnly || sinceMs !== undefined;
const filteredLabel =
hasFilters && filteredPaired.length !== totalPairedCount ? ` (of ${totalPairedCount})` : "";
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86c92cb4ce
ℹ️ 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".
| const sinceMs = parseSinceMs(opts.lastConnected, "Invalid --last-connected"); | ||
| const result = await callGatewayCli("node.pair.list", opts, {}); | ||
| const { pending, paired } = parsePairingList(result); | ||
| const nodeListResult = await callGatewayCli("node.list", opts, {}); |
There was a problem hiding this comment.
Avoid requiring node.list for plain nodes list
callGatewayCli("node.list", ...) is now unconditional, so even openclaw nodes list without --connected or --last-connected needs the node.list RPC. That regresses environments that only expose pairing capabilities: src/gateway/method-scopes.ts:38-43 puts node.pair.list behind operator.pairing, while src/gateway/method-scopes.ts:52-87 puts node.list behind operator.read, and other client code still treats node.list as optional/fallback-able when it is unavailable (src/cli/nodes-cli/rpc.ts:79-95). Before this change the unfiltered path only used node.pair.list, so least-privilege tokens and older gateways could still list paired nodes.
Useful? React with 👍 / 👎.
…lteredLabel guard
|
Thanks for the review! I've addressed both issues:
Changes pushed to the branch. |
When sessions.patch receives model='list' or model='status' from Control UI, it now returns a clear error message instead of failing with a confusing 'model not allowed: openai-codex/list' error. These are chat command aliases, not model identifiers. Fixes #51126
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71851ff56e
ℹ️ 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".
| const totalPairedCount = paired.length > 0 ? paired.length : livePairedNodes.length; | ||
| const filteredLabel = hasFilters && filteredPaired.length !== totalPairedCount | ||
| ? ` (of ${totalPairedCount})` |
There was a problem hiding this comment.
Keep filtered paired counts on the same data source
totalPairedCount now falls back to node.list, but filteredPaired still comes exclusively from node.pair.list. Those RPCs are not interchangeable: node.pair.list reads the gateway-owned node-pairing store, while node.list marks nodes as paired from device pairing (src/gateway/server-methods/nodes.ts:528-540 vs. src/gateway/server-methods/nodes.ts:645-705). In the common WS-node setup where device pairing exists but the separate node-pairing store is empty, openclaw nodes list --connected or --last-connected will now print Paired: 0 (of N) and show no paired rows at all, which is a misleading regression introduced by this fallback count.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dbb6dda2d
ℹ️ 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".
| if (trimmed.toLowerCase() === "list" || trimmed.toLowerCase() === "status") { | ||
| return invalid( | ||
| `invalid model: "${trimmed}" is a command alias, not a model. Use /models list or /model status in chat instead.`, | ||
| ); |
There was a problem hiding this comment.
Allow configured
list/status aliases through sessions.patch
src/commands/models/shared.ts:137-144 still accepts aliases like list and status, and src/agents/model-selection.ts:548-571 resolves bare aliases before parsing provider/model refs. This new early return bypasses that path, so any caller that sets a session model via sessions.patch to an allowed alias named list or status now gets invalid model even though the alias is valid everywhere else. That is a real regression for Control UI/API clients on configs that intentionally use those aliases.
Useful? React with 👍 / 👎.
| const livePairedNodes = Array.from(liveNodesById.values()).filter((n) => n.paired); | ||
| const totalPairedCount = paired.length > 0 ? paired.length : livePairedNodes.length; | ||
| const filteredLabel = | ||
| hasFilters && filteredPaired.length !== paired.length ? ` (of ${paired.length})` : ""; | ||
| hasFilters && filteredPaired.length !== totalPairedCount | ||
| ? ` (of ${totalPairedCount})` |
There was a problem hiding this comment.
Use the paired-node fallback for actual
nodes list output
When node.pair.list is empty but node.list marks nodes as paired: true (the exact WS-node case this change is trying to cover), the fallback is only applied to totalPairedCount. The command still logs/serializes filteredPaired, so plain openclaw nodes list reports Paired: 0, --json returns "paired": [], and no Paired table is rendered even though nodes status shows those same nodes as paired. This is separate from the existing filtered-label issue because it also breaks the unfiltered and JSON paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 285b401c3d
ℹ️ 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".
| if (trimmed.toLowerCase() === "list" || trimmed.toLowerCase() === "status") { | ||
| return invalid( | ||
| `invalid model: "${trimmed}" is a command alias, not a model. Use /models list or /model status in chat instead.`, | ||
| ); |
There was a problem hiding this comment.
Avoid reserving bare model IDs
list and status
This check now rejects valid model selections before resolveAllowedModelRef runs. src/commands/onboard-custom.ts:616-666 accepts any non-empty custom modelId, and src/agents/model-selection.ts:547-573 resolves bare refs against the session's default provider, so a gateway whose default provider exposes a real model named list or status can no longer be selected through sessions.patch even when it is allowlisted. That is a regression for Control UI/API clients on custom or local providers that use those IDs as actual model names.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a570251e45
ℹ️ 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".
| return invalid( | ||
| `invalid model: "${trimmed}" is a command alias, not a model. Use /models list or /model status in chat instead.`, |
There was a problem hiding this comment.
Point users to
/models instead of /models list
When sessions.patch rejects model: "list", this new hint tells the user to run /models list, but chat only supports /models or /models <provider>. resolveModelsCommandReply strips /models and treats the next token as a provider (src/auto-reply/reply/commands-models.ts:234-279), so /models list falls into the Unknown provider: list path instead of showing models. That leaves the new "clear" error pointing affected users at another failing command.
Useful? React with 👍 / 👎.
|
Closing this as duplicate or superseded after Codex automated review. PR #51027 should close as superseded. Current main already handles the shared chat Best possible solution: Close #51027 as superseded. Keep the shared chat 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. |
Summary
This PR contains two fixes:
Fix 1: Gateway - Reject 'list' and 'status' as invalid model refs (Fixes #51126)
When Control UI sends /model list or /model status commands, the Gateway now returns a clear error message instead of failing with a confusing model not allowed error.
Fix 2: CLI - Align nodes list and status to show consistent paired node count (Fixes #50847)
Changes
Gateway (sessions-patch.ts)
CLI (register.status.ts)
Testing