Skip to content

fix(cli): validate node options before contacting the Gateway - #130352

Merged
steipete merged 1 commit into
mainfrom
codex/loc-sweep-nodes-preflight-20260826
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-sweep-nodes-preflight-20260826

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #116652

What Problem This Solves

Fixes an issue where malformed openclaw nodes options contacted the Gateway before reporting their local validation error. An offline Gateway or unknown node could hide the useful error for invoke, notify, push, location, screen, and camera commands.

Why This Change Was Made

Run the existing pure option validators before resolving a node. Checks requiring a node's platform still happen after lookup. The push command directly uses the canonical normalized environment value, removing a one-use wrapper and duplicated option fields. Flags, defaults, error text, mixed-case environment names, and successful APNs output are preserved.

Production LOC: +18/-37 (net -19). Tests: +85/-30 (net +55). No dependency, configuration, schema, protocol, or API changes.

User Impact

Invalid local arguments now produce the intended diagnostic without needing a reachable Gateway. Valid invocations still contact the Gateway normally.

Evidence

  • Candidate ebd6139f28d116e9de96081608a3eb7bc1fe9f7e.
  • Before: 21 regression cases detected an unwanted node.list call before rejection. After: 97 owner and CLI E2E tests passed.
  • Actual built CLI: 20 invalid-input scenarios each exited with the expected diagnostic and made zero connections to an isolated TCP observer. A valid invocation reached that observer once, proving the check could detect traffic. No real APNs request was sent.
  • All 11 runtime/declaration build stages and native require validation passed. The complete changed-file gate passed with matching dependencies and no skipped gates.
  • Fresh structured Codex P1 review and independent source/runtime evidence review passed on this commit.
  • Maintainer-requested, AI-assisted repair and simplification. CI on the published candidate is required before landing.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 20:08
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:15 PM ET / 20:15 UTC.

ClawSweeper review

What this changes

Reorders node-command option validation before Gateway node lookup, simplifies push-environment normalization, and adds regression coverage.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking correctness findings. Current main resolves nodes through the Gateway before several pure local validators; this PR moves those validators ahead of resolution while retaining platform-dependent camera decisions afterward. Keep it open for normal maintainer handling and exact-head CI.

Priority: P2
Reviewed head: ebd6139f28d116e9de96081608a3eb7bc1fe9f7e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused owner-boundary repair and regression coverage support a normal merge-quality rating.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless supplies direct built-CLI TCP-observer evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless supplies direct built-CLI TCP-observer evidence.
Evidence reviewed 6 items Current-main failure boundary: Current main resolves the node before validating the push environment, so malformed local input can reach the Gateway lookup first.
Gateway lookup owner: The shared resolver performs node.list before resolving the requested node, establishing the network boundary that local validation must precede.
Sibling command coverage: The branch applies the same ordering to invoke, location, notify, camera, and screen owners, retaining platform-dependent camera target decisions after lookup.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw nodes push --node missing --environment staging

Result: FAIL (failed) — step 1 run pnpm openclaw nodes push --node missing --environment staging: previous terminal command was still running after 30 seconds: "pnpm openclaw nodes push --node missing --environment staging"

$ node scripts/run-node.mjs nodes push --node missing --environment staging
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 96.62 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.2s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4110ms (slowest: built plugin control-plane loads 3389ms)
│
◇

OpenClaw 2026.8.1 (ebd6139) — No, I can't solve captchas. Yes, that's exactly what a robot would say.

nodes push failed: invalid --environment (use sandbox|production)
[ELIFECYCLE] Command failed with exit code 1.

Assertions:

  • FAIL expect_output: invalid --environment (use sandbox|production)

How this fits together

The nodes CLI validates operator flags, resolves a paired node through the Gateway, then sends a node operation. This change prevents malformed local flags from being hidden by an unavailable Gateway.

flowchart LR
  A[Operator flags] --> B[Nodes CLI command]
  B --> C[Local option validation]
  C --> D[Gateway node lookup]
  D --> E[Node operation]
  E --> F[CLI output or diagnostic]
Loading

Before merge

  • Complete next step (P2) - This recent maintainer PR needs normal exact-head CI and landing review, not an automated repair lane.
Agent review details

Security

None.

PR surface

Source -19, Tests +55. Total +36 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 6 18 37 -19
Tests 2 85 30 +55
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 103 67 +36

Review metrics

Metric Value Why it matters
Production versus tests production +18/-37 (net -19); tests +85/-30 (net +55) The fix removes a one-use push wrapper while adding command-boundary regression coverage.

Stored data model

Persistent data-model change detected: serialized state: src/cli/program.nodes-push.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the command-owner ordering change after exact-head CI: validate every pure local option before resolveCliNode*, while keeping node-platform decisions after resolution.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main calls the resolver’s node.list path before several pure validators. This read-only review did not execute the CLI.

Is this the best way to solve the issue?

Yes. Command-owned pure validation belongs before Gateway resolution, and this patch correctly leaves platform-dependent camera checks after the resolved node is available.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 67a9b34e91e3.

Labels

Label changes:

  • add P2: This repairs a user-visible CLI diagnostic failure with limited blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless supplies direct built-CLI TCP-observer evidence.

Label justifications:

  • P2: This repairs a user-visible CLI diagnostic failure with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the contributor proof gate; its body nevertheless supplies direct built-CLI TCP-observer evidence.

Evidence

What I checked:

  • Current-main failure boundary: Current main resolves the node before validating the push environment, so malformed local input can reach the Gateway lookup first. (src/cli/nodes-cli/register.push.ts:43, 67a9b34e91e3)
  • Gateway lookup owner: The shared resolver performs node.list before resolving the requested node, establishing the network boundary that local validation must precede. (src/cli/nodes-cli/rpc.ts:304, 67a9b34e91e3)
  • Sibling command coverage: The branch applies the same ordering to invoke, location, notify, camera, and screen owners, retaining platform-dependent camera target decisions after lookup. (src/cli/nodes-cli/register.camera.ts:149, ebd6139f28d1)
  • Regression tests: The expanded table asserts malformed command inputs produce one diagnostic with no Gateway call, which would fail before the ordering change. (src/cli/nodes-cli.coverage.test.ts:296, ebd6139f28d1)
  • Feature provenance: Current-main blame attributes the shared numeric option validators to Vincent Koc; the related merged CLI repair is commit 467f072. (src/cli/nodes-cli/rpc.ts:209, b5fda038e1)
  • Real behavior evidence: The PR body reports built-CLI TCP-observer proof: 20 invalid inputs made zero connections, while a valid invocation connected once. (ebd6139f28d1)

Likely related people:

  • Vincent Koc: Current-main blame attributes the node numeric validation helpers to this contributor. (role: recent shared-validator contributor; confidence: medium; commits: b5fda038e1; files: src/cli/nodes-cli/rpc.ts)
  • steipete: Authored the related merged CLI repair and the current focused follow-up. (role: recent adjacent CLI contributor; confidence: medium; commits: 467f072f231b; files: src/cli/nodes-cli/register.location.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head landing verification: existing pure argument validation now runs before Gateway discovery across invoke, notify, push, location, screen, and camera. Platform-dependent camera checks remain after resolution. This removes the one-use push translator and duplicated fields: production −19 lines; tests +55.

The original parser repro failed 21 cases on unwanted node.list. Candidate proof passes 97 tests, all runtime/declaration build stages, and 20 actual built CLI invalid-input subprocesses with expected diagnostics and zero TCP connections; a valid canary made one connection. This is real CLI/network-boundary proof, not a claim of a live APNs send. Full changed gate, fresh P1 review and independent exact-head source/proof review pass. Exact-head CI is green for ebd6139.

Latest available review comments contain no actionable ClawSweeper rank-up list. The separately reviewed camera batch change will receive combined CLI/camera proof after this lands; neither validation ordering nor platform checks may be lost during integration.

@steipete
steipete merged commit 52beb5e into main Aug 26, 2026
211 checks passed
@steipete
steipete deleted the codex/loc-sweep-nodes-preflight-20260826 branch August 26, 2026 20:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
obviyus added a commit that referenced this pull request Sep 11, 2026
Reject an explicitly supplied blank push environment before node lookup while preserving omitted and normalized valid environments, request shaping, and complete failed-push output.

Related: #130352

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…144687)

Reject an explicitly supplied blank push environment before node lookup while preserving omitted and normalized valid environments, request shaping, and complete failed-push output.

Related: openclaw#130352

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant