Skip to content

fix(canvas): preserve Windows pnpm shim arguments - #133395

Merged
steipete merged 10 commits into
openclaw:mainfrom
ly85206559:codex/canvas-windows-pnpm-argv
Aug 31, 2026
Merged

steipete merged 10 commits into
openclaw:mainfrom
ly85206559:codex/canvas-windows-pnpm-argv

Conversation

@ly85206559

@ly85206559 ly85206559 commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Canvas builds launched through Windows pnpm .cmd shims could receive corrupted arguments: empty arguments disappeared, carets doubled, and quoting changed argument boundaries. The Canvas resolver supplies this command line to the A2UI bundler's real child process.

Why This Change Was Made

Apply the existing cmd.exe/CRT quoting contract at the Canvas runner: quote each token, preserve caret characters inside quotes, and handle backslash runs before embedded quotes and closing quotes. Keep unsafe-character rejection and the direct executable path. Remove the old conditional quoting helper. The implementation remains within the Canvas plugin boundary and is net-neutral in production (+14/-14).

The real Windows regression launches a spaced-path pnpm.cmd shim and checks the captured child argv for all four values in one invocation:

["", "left ^ right", "C:\\two words\\", "say \"hi\""]

The existing Windows CI inventory and selector now cover this owner and regression; upstream entries are preserved. Tests are +43 lines; CI tooling is +2/-2. Thanks @ly85206559.

Evidence

Native baseline job 99406726086 on 30afa0c65bc229102ca7e5607d7e93e32c8fcdc3 reproduced the exact argv corruption: the child exited 0, but its captured arguments were wrong. Three existing controls passed, and five POSIX-only cases skipped.

Final Windows job 99424485674 on e08ab3578f742d84b7f3044e4ee58f1974a07957 passed the unchanged real argv regression in 38 ms. All three controls also passed: native pnpm, native pnpm-native, and native PATH/spaced wrappers with unsafe-character rejection. The file finished with four passing cases, five platform skips, and no failures. Both runs used Windows 2025 and Node 22.23.2.

The final job executed GitHub merge 9f70e484544d41ba3cefeecc80bbb95b26c41adc, whose parents are main 65bb866a548a9499b893db3fb15818c358593490 and the published head. All five executed candidate files hash-match the complete reviewed candidate. The published tree also equals contributor refresh 4cd37ac23d41fc9c0ba02b85e3385bbb285fed57, covered by the latest ClawSweeper review; both contributor and maintainer histories are preserved.

Full exact-head CI 33371704201 succeeded. The final rollup had 237 successful checks, 41 skips, one neutral result, and no failures or pending checks. Complete independent Codex P0 review, targeted formatting, private staged scan, and source binding passed. Contributor source executed only in secretless hosted CI. This final native result supplies the proof requested by ClawSweeper.

Follow-up

The separate repository-script serializer in scripts/windows-cmd-helpers.mjs retains its older quoting path and remains a named follow-up. This PR repairs and proves the Canvas-owned build runner.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 extensions: canvas size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 30, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 31, 2026, 3:58 AM ET / 07:58 UTC.

ClawSweeper review

What this changes

This PR makes Canvas’s pnpm build runner preserve literal arguments through Windows .cmd shims, adds a native regression test, and routes that test to Windows CI.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 3 items remain

Keep open: the Canvas-owned repair is a focused match for the known Windows quoting failure and is not on current main, but the supplied native after-trace predates the reviewed head. A final-head native Windows result is still required before merge.

Priority: P2
Reviewed head: 4cd37ac23d41fc9c0ba02b85e3385bbb285fed57

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The code and boundary test are well targeted, but the exact reviewed head still lacks a recorded native after-result.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The changed owner is the Canvas pnpm resolver, reached by the A2UI bundler; supplied terminal output proves the real native baseline scenario but names an earlier head, not 4cd37ac. A redacted native Windows after-trace for the reviewed head or verified test merge must show the exact child argv assertion passing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The changed owner is the Canvas pnpm resolver, reached by the A2UI bundler; supplied terminal output proves the real native baseline scenario but names an earlier head, not 4cd37ac. A redacted native Windows after-trace for the reviewed head or verified test merge must show the exact child argv assertion passing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Canvas entry point and owner: The A2UI bundler passes its pnpm arguments to the Canvas-local resolver and launches the returned spawn specification, so this serializer owns the affected build path.
Focused serializer repair: The introduced serializer retains the unsafe-character rejection and applies the established quote-every-token/backslash rule before windowsCmdSpec passes the result to cmd.exe.
Existing core pattern: Current main’s core Windows process owner uses the same quoting algorithm; Canvas correctly retains a local copy because the plugin boundary forbids importing core internals.
Findings None None.
Security None None.

How this fits together

Canvas’s A2UI bundle script resolves pnpm and launches it to build web assets. Windows pnpm shims insert cmd.exe and CRT parsing between Canvas’s argument array and the spawned build process.

flowchart LR
  A[Canvas A2UI bundle] --> B[pnpm runner]
  B --> C{Windows cmd shim}
  C -->|Yes| D[Quoted command line]
  C -->|No| E[Direct executable]
  D --> F[pnpm shim]
  E --> G[Build process]
  F --> G
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The changed owner is the Canvas pnpm resolver, reached by the A2UI bundler; supplied terminal output proves the real native baseline scenario but names an earlier head, not 4cd37ac. A redacted native Windows after-trace for the reviewed head or verified test merge must show the exact child argv assertion passing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Without a native after-result tied to 4cd37ac, a Windows Canvas build using a .cmd shim remains unverified at the exact merge candidate.
  • Complete next step (P2) - No separate repair job is needed; the contributor must provide exact-head native behavior proof before this otherwise focused patch can proceed.
Agent review details

Security

None.

PR surface

Source 0, Tests +43, Config 0, Other 0. Total +43 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 14 0
Tests 2 43 0 +43
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 1 1 1 0
Total 5 59 16 +43

Review metrics

Metric Value Why it matters
Production versus test delta runtime +14/-14; CI tooling +2/-2; tests +43/-0 Production remains net-neutral while the added test coverage directly exercises native Windows argument preservation and its CI routing.

Stored data model

Persistent data-model change detected: migration/backfill/repair: package.json, serialized state: extensions/canvas/scripts/pnpm-runner.mjs, vector/embedding metadata: scripts/ci-changed-scope.mjs. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Record final-head Windows argv proof (recommended)
    Attach a redacted native Windows trace for the reviewed head that shows the Canvas .cmd shim preserving the asserted argv values before merge.

Technical review

Best possible solution:

Retain the Canvas-local serializer and merge only after a redacted native Windows run at the reviewed head shows the exact argv regression passing and the attached Windows CI completes.

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

Yes: the supplied native Windows baseline records corrupted child argv, and the current source exposes the same Canvas resolver-to-cmd invocation path. The after-result is not yet tied to the reviewed head.

Is this the best way to solve the issue?

Yes: this is the appropriate owner-local repair because Canvas has its own build runner and cannot import the core-private serializer; the implementation matches the current shared Windows quoting pattern.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The changed command-line serialization governs whether existing Windows Canvas builds receive their pnpm arguments unchanged.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.

Label justifications:

  • P2: This is a bounded Windows build-runner correctness repair with limited blast radius.
  • merge-risk: 🚨 compatibility: The changed command-line serialization governs whether existing Windows Canvas builds receive their pnpm arguments unchanged.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The changed owner is the Canvas pnpm resolver, reached by the A2UI bundler; supplied terminal output proves the real native baseline scenario but names an earlier head, not 4cd37ac. A redacted native Windows after-trace for the reviewed head or verified test merge must show the exact child argv assertion passing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Canvas entry point and owner: The A2UI bundler passes its pnpm arguments to the Canvas-local resolver and launches the returned spawn specification, so this serializer owns the affected build path. (extensions/canvas/scripts/bundle-a2ui.mjs:165, 4cd37ac23d41)
  • Focused serializer repair: The introduced serializer retains the unsafe-character rejection and applies the established quote-every-token/backslash rule before windowsCmdSpec passes the result to cmd.exe. (extensions/canvas/scripts/pnpm-runner.mjs:109, 4cd37ac23d41)
  • Existing core pattern: Current main’s core Windows process owner uses the same quoting algorithm; Canvas correctly retains a local copy because the plugin boundary forbids importing core internals. (src/process/windows-command.ts:175, e7bacb6e552a)
  • Boundary-level regression coverage: The new Windows-only test creates a spaced .cmd shim, invokes the returned specification, and compares the actual child argv for empty, caret, trailing-backslash, and quote cases; prior coverage only checked a simple wrapper and unsafe input. (extensions/canvas/scripts/pnpm-runner.test.ts:192, 4cd37ac23d41)
  • Windows CI selection: The test is added to the Windows inventory, the changed-scope matcher admits precisely the Canvas runner and its regression, and the routing test covers both matching paths plus an unrelated Canvas path. (scripts/ci-changed-scope.mjs:76, 4cd37ac23d41)
  • Verified commit sequence and current-main status: The raw-parent sequence deliberately restored the old serializer for a baseline at df3f016, restored the repair at 6396b7e, then added routing at 4cd37ac. The verified test merge against fetched main still changes all five PR files, so current main has not absorbed this Canvas repair. (extensions/canvas/scripts/pnpm-runner.mjs:109, 6396b7e997f2)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • chelsealong: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted terminal or CI log from 4cd37ac showing the native argv test passing.
  • Let the exact-head Windows CI complete; update the PR body with the result so ClawSweeper can refresh the review.

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-30T17:01:55.616Z sha b0204e0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T17:21:27.931Z sha b0204e0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-31T06:43:11.702Z sha 97d459f :: needs real behavior proof before merge. :: [P1] Restore the serializer before enabling this Windows regression

@ly85206559

Copy link
Copy Markdown
Contributor Author

Exact-head Windows behavior proof for b0204e0087f43632cd07fa4781286b15f8f170c9:

$ node scripts/run-vitest.mjs extensions/canvas/scripts/pnpm-runner.test.ts   # regression before production fix
Expected: ["", "left ^ right", "C:\\two words\\", "say \"hi\""]
Received: ["left ^^ right", "C:\\two words\" say", "hi\""]
Tests  1 failed | 3 passed | 5 skipped (9)

$ node scripts/run-vitest.mjs extensions/canvas/scripts/pnpm-runner.test.ts   # exact head
Test Files  1 passed (1)
Tests  4 passed | 5 skipped (9)

The regression creates and launches an actual .cmd shim from a path containing spaces, passes the four argv edge cases through cmd.exe, and captures the child Node process argv. This is the same quoting contract fixed in core by #133185.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 30, 2026
@steipete steipete self-assigned this Aug 31, 2026
Route the Canvas pnpm runner and its real child-process regression through the existing Windows test inventory. Temporarily retain the upstream serializer to capture the regression failure before restoring the reviewed repair. This proof baseline is not a landing candidate.

Co-authored-by: ben.li <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 31, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 31, 2026
steipete and others added 2 commits August 30, 2026 23:50
Preserve the contributor branch and current upstream Windows test entries while adding the Canvas argument round-trip regression exactly once. Keep the original serializer temporarily for native Windows failure proof before publishing the reviewed repair.

Co-authored-by: ben.li <[email protected]>
Use the existing cmd.exe and CRT quoting contract, preserving empty arguments, carets, trailing backslashes and embedded quotes. Keep the unsafe-character guard and direct executable path while removing conditional quoting. The original serializer reproduced exact argv corruption on the native Windows regression.

Co-authored-by: ben.li <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The original serializer failed the real Windows argv regression at baseline30afa0; ordinary native executable controls passed. Published the reviewed repair on the same contributor ancestry. The regression is now in the existing Windows inventory and must pass at the final head before landing; no workflow or runner policy was added.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

ly85206559 and others added 4 commits August 31, 2026 15:41
Route the Canvas pnpm runner and its real child-process regression through the existing Windows test inventory. Temporarily retain the upstream serializer to capture the regression failure before restoring the reviewed repair. This proof baseline is not a landing candidate.

Co-authored-by: ben.li <[email protected]>
Use the existing cmd.exe and CRT quoting contract, preserving empty arguments, carets, trailing backslashes and embedded quotes. Keep the unsafe-character guard and direct executable path while removing conditional quoting. The original serializer reproduced exact argv corruption on the native Windows regression.

Co-authored-by: ben.li <[email protected]>
@ly85206559
ly85206559 force-pushed the codex/canvas-windows-pnpm-argv branch from 8d2667a to 4cd37ac Compare August 31, 2026 07:50
Preserve the verified serializer and native argv regression while retaining upstream Windows test inventory additions.

Co-authored-by: ben.li <[email protected]>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 31, 2026
Merge the contributor update without replacing either history. Keep the reviewed Windows serializer, native regression, and complete test inventory.

Co-authored-by: ben.li <[email protected]>
@steipete
steipete merged commit 253ad3e into openclaw:main Aug 31, 2026
285 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@ly85206559
ly85206559 deleted the codex/canvas-windows-pnpm-argv branch August 31, 2026 13:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
* fix(canvas): preserve Windows pnpm shim arguments

* test(canvas): exercise cmd arguments on native Windows CI

Route the Canvas pnpm runner and its real child-process regression through the existing Windows test inventory. Temporarily retain the upstream serializer to capture the regression failure before restoring the reviewed repair. This proof baseline is not a landing candidate.

Co-authored-by: ben.li <[email protected]>

* fix(canvas): preserve literal arguments through Windows pnpm shims

Use the existing cmd.exe and CRT quoting contract, preserving empty arguments, carets, trailing backslashes and embedded quotes. Keep the unsafe-character guard and direct executable path while removing conditional quoting. The original serializer reproduced exact argv corruption on the native Windows regression.

Co-authored-by: ben.li <[email protected]>

* fix(canvas): preserve Windows pnpm shim arguments

* test(canvas): exercise cmd arguments on native Windows CI

Route the Canvas pnpm runner and its real child-process regression through the existing Windows test inventory. Temporarily retain the upstream serializer to capture the regression failure before restoring the reviewed repair. This proof baseline is not a landing candidate.

Co-authored-by: ben.li <[email protected]>

* fix(canvas): preserve literal arguments through Windows pnpm shims

Use the existing cmd.exe and CRT quoting contract, preserving empty arguments, carets, trailing backslashes and embedded quotes. Keep the unsafe-character guard and direct executable path while removing conditional quoting. The original serializer reproduced exact argv corruption on the native Windows regression.

Co-authored-by: ben.li <[email protected]>

* fix(ci): route Canvas regression to Windows

---------

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

Labels

extensions: canvas merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants