fix(build): add WSL detection to bundle-a2ui.sh#33321
fix(build): add WSL detection to bundle-a2ui.sh#33321BinHPdev wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds a WSL detection guard to However, the WSL detection condition on line 32 is overly broad. It triggers for all WSL environments, not just the specific failure case (Windows pnpm spawning WSL bash without Node.js available). This creates a regression: developers using WSL2 as their primary development environment with Node.js installed inside WSL would be forced to use a potentially stale prebuilt bundle or blocked from building entirely if no prebuilt bundle exists. The guard should also check that Node.js is absent ( Confidence Score: 2/5
Last reviewed commit: 6c42eaa |
scripts/bundle-a2ui.sh
Outdated
| if grep -qi microsoft /proc/version 2>/dev/null; then | ||
| if [[ -f "$OUTPUT_FILE" ]]; then | ||
| echo "WSL detected; using prebuilt A2UI bundle." | ||
| exit 0 | ||
| fi | ||
| echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2 | ||
| echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 | ||
| exit 1 |
There was a problem hiding this comment.
WSL guard too broad — breaks WSL-primary developers
This guard triggers for all WSL environments, not just the specific failure case described in the PR (Windows pnpm spawning WSL bash where Node.js is absent).
A developer using WSL2 as their primary environment with Node.js installed inside WSL would hit this guard and either be forced to use a potentially stale prebuilt bundle (line 34) or fail entirely (line 39) if no prebuilt bundle exists. This blocks a legitimate development scenario.
The actual failure condition is WSL and Node.js absent. Adding a check for node availability would narrow the guard precisely:
| if grep -qi microsoft /proc/version 2>/dev/null; then | |
| if [[ -f "$OUTPUT_FILE" ]]; then | |
| echo "WSL detected; using prebuilt A2UI bundle." | |
| exit 0 | |
| fi | |
| echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2 | |
| echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 | |
| exit 1 | |
| if grep -qi microsoft /proc/version 2>/dev/null && ! command -v node >/dev/null 2>&1; then | |
| if [[ -f "$OUTPUT_FILE" ]]; then | |
| echo "WSL detected (no Node.js available); using prebuilt A2UI bundle." | |
| exit 0 | |
| fi | |
| echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2 | |
| echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2 | |
| exit 1 | |
| fi |
This allows WSL developers with Node.js installed to build normally, while still protecting against the Windows-pnpm-to-WSL-bash scenario.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/bundle-a2ui.sh
Line: 32-39
Comment:
**WSL guard too broad — breaks WSL-primary developers**
This guard triggers for *all* WSL environments, not just the specific failure case described in the PR (Windows `pnpm` spawning WSL bash where Node.js is absent).
A developer using WSL2 as their primary environment with Node.js installed inside WSL would hit this guard and either be forced to use a potentially stale prebuilt bundle (line 34) or fail entirely (line 39) if no prebuilt bundle exists. This blocks a legitimate development scenario.
The actual failure condition is WSL *and* Node.js absent. Adding a check for node availability would narrow the guard precisely:
```suggestion
if grep -qi microsoft /proc/version 2>/dev/null && ! command -v node >/dev/null 2>&1; then
if [[ -f "$OUTPUT_FILE" ]]; then
echo "WSL detected (no Node.js available); using prebuilt A2UI bundle."
exit 0
fi
echo "WSL environment detected but no prebuilt bundle found at: $OUTPUT_FILE" >&2
echo "Build outside WSL first (e.g. Git Bash): pnpm canvas:a2ui:bundle" >&2
exit 1
fi
```
This allows WSL developers with Node.js installed to build normally, while still protecting against the Windows-pnpm-to-WSL-bash scenario.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch — narrowed the guard to grep -qi microsoft /proc/version && \! command -v node in f54b881. WSL-primary developers with Node.js installed will now build normally.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c42eaaae2
ℹ️ 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".
scripts/bundle-a2ui.sh
Outdated
| # The pnpm wrappers for tsc/rolldown also invoke node internally, so the | ||
| # entire build pipeline fails. Use the prebuilt bundle when available; | ||
| # otherwise guide the user to build outside WSL where Windows node is on PATH. | ||
| if grep -qi microsoft /proc/version 2>/dev/null; then |
There was a problem hiding this comment.
Avoid blocking all WSL builds when bundle is absent
This guard makes pnpm canvas:a2ui:bundle fail unconditionally on any WSL host when src/canvas-host/a2ui/a2ui.bundle.js is not already present, even if Node/tsc/rolldown are correctly installed in WSL. Because src/canvas-host/a2ui/*.bundle.js is gitignored, a clean checkout in WSL will hit this path and cannot produce the bundle at all, which is a regression from the previous behavior where WSL users could build locally.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f54b881 — the guard now only triggers when WSL is detected and node is not on PATH. Clean WSL checkouts with Node.js installed can build normally.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f54b881fef
ℹ️ 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".
| if [[ -f "$OUTPUT_FILE" ]]; then | ||
| echo "WSL detected (no Node.js available); using prebuilt A2UI bundle." | ||
| exit 0 |
There was a problem hiding this comment.
Validate prebuilt bundle freshness before exiting on WSL
In the new WSL fallback branch, if WSL is detected and node is missing, the script now exits 0 as soon as a2ui.bundle.js exists, without checking whether it matches current A2UI sources. This means a stale bundle from a previous checkout/build can be silently reused when vendor/a2ui/renderers/lit or apps/shared/OpenClawKit/Tools/CanvasA2UI changed, producing outdated assets in pnpm build outputs instead of forcing regeneration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f75941a94
ℹ️ 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".
| if [[ -f "$OUTPUT_FILE" ]]; then | ||
| echo "WSL detected (no Node.js available); using prebuilt A2UI bundle." | ||
| exit 0 |
There was a problem hiding this comment.
Check bundle freshness before WSL early exit
Fresh evidence in be7a32c is that the new WSL/no-Node branch returns success as soon as a2ui.bundle.js exists, but this happens before compute_hash runs, so source changes in vendor/a2ui/renderers/lit or apps/shared/OpenClawKit/Tools/CanvasA2UI are never detected in that path. In WSL environments without Node installed, this can let pnpm build succeed with an outdated bundle instead of forcing regeneration or a hard failure.
Useful? React with 👍 / 👎.
|
still open ? |
Summary
scripts/bundle-a2ui.shthat exits early using the prebuilt bundle, mirroring the existing Docker fallback patternpnpmresolvesbashtoC:\Windows\System32\bash.exe(WSL), where native Node.js is typically absent — this causescompute_hash(node --input-type=module) andpnpm exec tsc/rolldownto failThis is a minimal, focused extract from #26070 — only the WSL detection guard, no hash algorithm changes (preserves existing cache semantics).
Relates to #10070
Changes
Adds a WSL check (
grep -qi microsoft /proc/version) before the hash/build pipeline:No changes to
compute_hash, no changes to cache behavior.Test plan
pnpm buildcompletes on Windows 11 + WSL2 (WSL bash detects WSL, uses prebuilt bundle, exits 0)pnpm canvas:a2ui:bundleworks normally on macOS / Linux / Git Bash (WSL guard is skipped)🤖 Generated with Claude Code