Repository navigation
refactor(canvas): reuse canonical node CLI helpers - #135303
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 2:47 PM ET / 18:47 UTC. ClawSweeper reviewWhat this changesThe PR replaces Canvas-local node CLI option, invocation, terminal-output, and error helpers with a new documented Merge readinessKeep open for a Plugin SDK-owner decision: this adds a typed, documented third-party SDK contract, and the prior review’s request for explicit contract direction is not resolved in the supplied discussion. The implementation itself has no blocking correctness finding. Priority: P3 Review scores
Verification
How this fits togetherCanvas registers a plugin-owned node command that resolves a target and invokes it through the Gateway. The proposed facade sits between plugin commands and the core node CLI helpers, making their flags, invocation envelope, output, and failure presentation reusable. flowchart LR
A[Plugin node command] --> B[Node CLI SDK facade]
B --> C[Core node CLI helpers]
C --> D[Gateway client]
D --> E[Paired node action]
E --> F[Terminal result]
Decision needed
Why: The code correctly exposes a narrow generic seam, but choosing to support its four helper behaviors across external plugins is a durable API-direction decision rather than a mechanical repair. Before merge
Agent review detailsSecurityNone. PR surfaceSource -36, Tests +100, Docs +13, Config +4, Other +4. Total +85 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Either record explicit acceptance of this narrow third-party node-CLI SDK contract and retain the facade, or keep the helpers Canvas-local until a supported cross-plugin need is established. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR does not report a broken existing behavior. Its captured body does provide terminal evidence of a built-CLI parity corpus for the refactored command path. Is this the best way to solve the issue? Unclear: delegating to the existing core owners is a maintainable implementation, but whether those owners should become a supported third-party SDK contract needs explicit direction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d17027cfdc5e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
Canvas duplicated the node CLI’s option registration, invoke envelope, terminal theme, and error wrapper. This refactor delegates those responsibilities to their existing owners through the typed
openclaw/plugin-sdk/node-cli-runtimefacade and deletes the Canvas copies. Canvas retains its own node selection, Gateway caller, transport deadline, blank invoke-timeout handling, and legacy inventory fallback. Commands, defaults, requests, errors, and presentation are unchanged.The supported SDK subpath is registered in package exports, the canonical entrypoint inventory, both SDK documentation pages, and the measured surface budget. Its four exports declare existing command flags, construct invocation data, adapt terminal styling, and wrap CLI outcomes; they expose no privileged Gateway caller and change no credential, authorization, configuration, protocol, or persistence behavior. This is a deliberate narrow SDK compatibility commitment.
The complete nine-file change removes 28 production lines: 25 added / 53 deleted, including all facade and metadata growth. Runtime TypeScript alone decreases by 36 lines. Tests add 100 physical lines (96 nonblank); docs add 13 (11 nonblank). No pure move or test deletion counts toward the production reduction. No performance improvement is claimed.
The PR also repairs the native-child lifecycle in an installer cancellation test exposed by Windows CI. It observes the actual child’s readiness, waits for child closure before removing its files, and retains the original 750 ms bound on the next namespace-queue admission. The bound starts immediately after abort and observes the next bundle’s HTTP request, before cold extraction and prewarming. The first cancellation, second complete result, and child cleanup remain separately asserted. This changes the fixture, not the installer. A deliberate 1500 ms delay in the second queue task passes the preceding fixture but fails the corrected 750 ms assertion; the original source was restored byte-for-byte after each probe. No test deadline, retry count, or environment was relaxed.
Validation on the final candidate:
The comparable built-CLI corpus SHA-256 is
f8aca059d0276632f3933022a79618db7052eda7d06cf2e4fcf127b086fb29be. This proves the command and local Gateway wire boundary, not a live macOS panel, external node, or captured connect-frame identity. The unchanged Canvas-specific caller owns connection identity. The local installer run is macOS/Node 24.19 evidence; native Windows CI on the published commit is still required before landing.The branch incorporates reviewed main at
91067e340a18; the SDK budget conflict was resolved using the actual export inventory. Earlier Windows readiness/teardown failures, failed source-bootstrap attempts, and the original tee-wrapped build’s missing outer exit are retained as failed or limited evidence. Later successful commands carry their actual exit codes; none of those earlier attempts is counted as a pass. A pre-existing node CLI registration snapshot mismatch remains a named follow-up. Exact-head hosted CI remains the landing gate.The latest ClawSweeper review at18:47UTC covers this exact head and reports no correctness or security finding. Its remaining SDK-direction request is explicitly dispositioned below.
SDK contract decision and review disposition: retain
node-cli-runtimeas the supported four-helper entry point documented in this PR. I read the complete current SDK guide and ownership rules, and the facade plus both owning modules. The guide’s additional SDK/security-owner acceptance gate applies to shortened compatibility windows, source-incompatible shipped types, or wider trust, authority, or persistence boundaries. This change does none of those: it exports onlygetNodesTheme,runNodesCommand,buildNodeInvokeParams, andnodesCallOpts, with no privileged Gateway RPC export. Separate owner acceptance is therefore not required by that gate; no separate approval is claimed. This explicitly addresses the prior ClawSweeper decision/rank-up request while retaining the normal branch-review and CI requirements.Final CI33544343366 passed on
e40e2a5d3dc6:224 successful jobs,12 intentional skips, both Windows jobs and the required gate green. Actual Windows checkout4b0becb8619dmerged the head into9030d86e7be9, using Node22.23.2 and pnpm12.1.0. The installer’s27 cases all passed, including the cancellation/queue/child-cleanup case. Its658ms is total test duration, not a separately measured handoff latency. The final gate and actual ciArtifacts build passed; no skipped lane or earlier limited build is relabeled as executed proof.Fresh whole-nine-file high/P2 review passed all seven passes, and the final code/metadata reduction remains28 production lines, with100 test lines and13 documentation lines added. The initial local commit hook could not find Node and wrote no commit; supplying the already installed runtime allowed the unchanged reviewed bytes through the normal hook, commit and push.