Repository navigation
fix(install): repair set-npm-prefix rc line and surface silent finalization failures - #133869
Conversation
…zation failures - install-cli.sh --set-npm-prefix wrote an over-escaped PATH line: the backslash-escaping expanded PATH at install time, appending a literal \"-quoted, frozen PATH snapshot to .bashrc/.zshrc that never resolves the npm-global bin dir. Use the same correct form as install.sh. - install.sh finalization helpers (retire_npm_owner_after_git_install, retire_git_wrapper_after_npm_install) could abort the install with exit 1 and no output; each fatal path now prints an actionable error. - prepare_git_wrapper_backup_for_npm no longer hard-fails when npm is missing (Arch splits node/npm): there is nothing to back up, and the npm install step already reports the missing npm with remediation. - install-cli.sh --compatible-with with an unresolvable --version died silently through set -e before its error message; the failed npm view now reaches the explicit fail path (and the JSON error event).
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 31, 2026, 2:31 AM ET / 06:31 UTC. ClawSweeper reviewWhat this changesThe PR fixes the CLI installer’s shell startup PATH line and makes npm-version resolution and install finalization failures visible to operators. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. The branch directly repairs current-main installer defects, but it changes only production scripts and lacks focused regression coverage for the repaired shell output and formerly silent failures. Priority: P2 Review scores
Verification
How this fits togetherThe shell installers provision OpenClaw through npm or a Git checkout, update login-shell configuration, and retire replaced launchers. Their finalization paths determine whether users receive a usable command or an actionable failure. flowchart LR
A[Installer options] --> B[CLI installer]
B --> C[Shell startup file]
B --> D[Version compatibility check]
E[Git or npm installation] --> F[Install finalization]
F --> G[Launcher transition]
C --> H[Usable OpenClaw command]
D --> H
G --> H
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceOther +20. Total +20 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Add focused before/after shell-boundary regressions for the rc-file line and each newly explicit failure path, then retain this producer-side repair. Do we have a high-confidence way to reproduce the issue? No independent high-confidence run was executed in this read-only review; the old and new shell expansions make the rc-file defect source-reproducible, and the captured PR body reports a before/after run. Is this the best way to solve the issue? Yes, conditionally. The patch repairs the producer of the malformed shell line and the set-e exits rather than compensating downstream, but needs direct regression coverage for those boundaries. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 70338624f636. LabelsLabel changes:
Label 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
|
…zation failures (openclaw#133869) - install-cli.sh --set-npm-prefix wrote an over-escaped PATH line: the backslash-escaping expanded PATH at install time, appending a literal \"-quoted, frozen PATH snapshot to .bashrc/.zshrc that never resolves the npm-global bin dir. Use the same correct form as install.sh. - install.sh finalization helpers (retire_npm_owner_after_git_install, retire_git_wrapper_after_npm_install) could abort the install with exit 1 and no output; each fatal path now prints an actionable error. - prepare_git_wrapper_backup_for_npm no longer hard-fails when npm is missing (Arch splits node/npm): there is nothing to back up, and the npm install step already reports the missing npm with remediation. - install-cli.sh --compatible-with with an unresolvable --version died silently through set -e before its error message; the failed npm view now reaches the explicit fail path (and the JSON error event).
#134386) Windows installations can now recover automatically when winget, Chocolatey, or Scoop fails or leaves an unsupported Node.js runtime. Guarded package-manager attempts warn and continue through the remaining methods to the existing elevation-free portable Node installer. Runtime validation still gates OpenClaw installation. The installer remains the sole owner of runtime provisioning. Updated Windows documentation and regression coverage describe and protect failure fallthrough, successful recovery, and final refusal when no usable runtime can be provisioned. Validation: all 99 exact-head checks completed without failures, including Windows installer CI and openclaw/ci-gate. The isolated Windows recovery trace exercised real portable download, extraction, PATH recovery, and runtime/SQLite validation after an injected Chocolatey failure. Codex review was scoped-clean; ClawSweeper reported no actionable findings or Rank-up moves. Related: #133869
openclaw#134386) Windows installations can now recover automatically when winget, Chocolatey, or Scoop fails or leaves an unsupported Node.js runtime. Guarded package-manager attempts warn and continue through the remaining methods to the existing elevation-free portable Node installer. Runtime validation still gates OpenClaw installation. The installer remains the sole owner of runtime provisioning. Updated Windows documentation and regression coverage describe and protect failure fallthrough, successful recovery, and final refusal when no usable runtime can be provisioned. Validation: all 99 exact-head checks completed without failures, including Windows installer CI and openclaw/ci-gate. The isolated Windows recovery trace exercised real portable download, extraction, PATH recovery, and runtime/SQLite validation after an injected Chocolatey failure. Codex review was scoped-clean; ClawSweeper reported no actionable findings or Rank-up moves. Related: openclaw#133869
Summary
A full audit of the three hosted installers (run from openclaw.ai against the synced copies, verified against this repo's
scripts/sources) found several verified defects. This PR fixes the three highest-confidence shell ones; the remaining findings are listed below for follow-up.Fixed here
install-cli.sh --set-npm-prefixcorrupted shell rc files (P1). The PATH line was over-escaped:\\\"collapsed to a literal\"and\\$PATHexpanded at install time, so.bashrc/.zshrcreceived a line wrapped in literal backslash-quotes containing a frozen snapshot of the install-time PATH. The npm-global bin dir was never actually resolvable from it, and the user's PATH was frozen to install-time values.install.shalready used the correct form; this backports it.install.shcould exit 1 with zero output (P1). The finalization helpers (retire_npm_owner_after_git_install,retire_git_wrapper_after_npm_install) had silent fatal paths; each now prints an actionable error.prepare_git_wrapper_backup_for_npmno longer hard-fails when npm is missing (Arch installs node without npm): there is nothing to back up, and the npm install step already reports missing npm with remediation — previously that case died silently before any message.install-cli.sh --compatible-withwith an unresolvable--versiondied silently. The failednpm viewkilled the script throughset -ebefore the intendedfail(and its JSON error event) could run; the resolution failure now reaches the explicit error path.Verification
pnpm vitest run test/scripts/install-cli.test.ts test/scripts/install-sh.test.ts— 270/270 pass with these changes.bash -nandshellcheck -S warningclean on both scripts.export PATH=\"/home/u/.npm-global/bin:\<frozen 1KB PATH snapshot>\", new form writesexport PATH="/home/u/.npm-global/bin:$PATH".Proposed changelog entry (not included: add on merge)
Audit findings NOT fixed here (follow-ups, roughly by priority)
$ErrorActionPreference = "Stop"+ stderr redirection (2>&1/2>$null) can abort mid-install on the first npm stderr warning; several call sites are unguarded (e.g.npm config get min-release-age), and the npm-failure diagnostics path itself can be killed by npm's ownnpm erroroutput.Install-Nodeaborts instead of falling through to the elevation-free portable Node path; the winget failure message advises a rerun that deterministically fails again.--min-release-age=0(install.sh's user-configured branch assigns the same value, making it dead code), silently defeating a user's supply-chain cooldown; decide whether that override is intentional and log it either way.curl | bash(stdin-pipe check runs before the controlling-TTY check), so the rich UI only appears for file-based runs; shellGIT_DIRvariable can collide with an exported gitGIT_DIRenv var;exec openclaw onboardskips the temp-file cleanup trap;--dry-rundownloads gum before the dry-run gate;--version latestfor the git method silently degrades to movingmainwhen the registry is unreachable (andresolve_git_openclaw_refuses barenpmfrom PATH instead of the managed$(npm_bin)that install-cli.sh uses).--jsonNDJSON stdout gets polluted by npm/pnpm child output; severalset -edeath paths emit no JSON error event; sudo/git prompts can still block a TTY-attached non-interactive run (sudo -n/GIT_TERMINAL_PROMPT=0are unset); managed-Node upgrade removes the old runtime before the new one is extracted; non-Alpine musl distros get the glibc tarball with a misleading remediation.SecurityProtocolTLS floor for PS 5.1; no checksums for portable Node/MinGit; missing-UseBasicParsingon the MinGit download; user PATH rewrite flattensREG_EXPAND_SZ; non-ASCII profile paths break the git-method.cmdwrapper (OEM codepage);Ensure-OpenClawOnPathfailure exits 0.