Skip to content

fix(install): use the git target's own engines instead of the npm fallback floor - #187635

Merged
steipete merged 1 commit into
mainfrom
fix/install-git-target-engines-187613
Oct 29, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/install-git-target-engines-187613

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #187613, a regression introduced by #187564: git installs unnecessarily provision a newer Node runtime even when the selected source and SQLite checks accept the installed runtime. Thanks @McgAtom for the report and reproduction.

User Impact

Git installs retain Node 24.21.0 for main's relaxed engine range, while older refs with stricter engines still upgrade it. Bash and PowerShell both use the selected checkout's requirement. npm installs continue using the selected package's metadata and conservative fallback.

Why This Change Was Made

The npm fallback remained active for git installs because engine resolution returned early. Runtime admission now happens after the git checkout/ref is selected and before pnpm bootstrap. Bash reads the checkout manifest without requiring Node first; PowerShell uses its built-in JSON reader. The existing Node provisioning and SQLite checks remain the admission owner. Related: #187627 handles main through installer constants; this change reads the actual selected checkout for every ref and includes PowerShell. npm ownership discovery follows successful git installation so it cannot run before git runtime selection.

The simplification moves the existing Node setup into one reusable operation per installer rather than adding another provisioning path. Production: +79/-58 lines (net +21); regression/fixture coverage: +70 lines; docs: +1/-1. No dependencies, options, schemas, or baselines change.

Evidence

  • Regressions: Bash main/strict-ref cases and the equivalent PowerShell production-flow fixture pass, alongside all six existing npm metadata/fallback cases. The new main and PowerShell regressions fail on the untouched installers for the unwanted provisioning/early-admission behavior.
  • Installer harness: node scripts/run-vitest.mjs test/scripts/install-sh.test.ts test/scripts/install-ps1.release.test.ts --maxWorkers=1 --reporter=dot: 266 passed, 3 platform skips, 2 inherited failures; 82.89 seconds wall. PowerShell ran under portable 7.6.9. The separate install-ps1.test.ts also passed in the initial combined run. Native Windows installation remains CI coverage.
  • The two inherited Bash failures are gives a working PATH remedy after a writable npm prefix with quoted prefix and prints a literal-safe direct PATH remedy for zsh (unexpected EOF / unmatched quote). Both reproduce on the untouched base and are already documented in fix(install): upgrade Node when it does not satisfy the target release's engines #187564; they were not masked or claimed passing.
  • Consumer proof: node scripts/run-vitest.mjs test/scripts/standalone-installers.test.ts test/scripts/build-and-run-mac.test.ts test/scripts/install-git-ref.test.ts test/scripts/install-bun.test.ts src/install-sh-version.test.ts --maxWorkers=1 --reporter=dot: 196 passed across five files / three shards, 38.71 seconds wall.
  • Targeted scripts-test tsgo, touched-file oxlint/oxfmt, Bash and PowerShell syntax, git diff --check, and madge passed (0 cycles).
  • check:max-lines-ratchet --base 3263a51fc3a7: passed, 404 grandfathered suppressions and 458/458 environment names. check:test-lines-ratchet --base 3263a51fc3a7: passed, 6,266,599 lines; ceiling 6,324,751; slack 58,152. The additional line-cap ratchet passed for both changed source files.
  • Codex autoreview was scoped-clean at P0–P2. Local ClawSweeper was unavailable because its shared runner checkout has unrelated edits; hosted review is requested when ready.
  • Full check:changed SQLite inventory omitted under the campaign's local gate budget; targeted checks above provide local proof and PR CI supplies broad proof.
Live Docker installer proof

All three runs used node:24.21.0-bookworm, isolated HOME and OPENCLAW_STATE_DIR, and standalone scripts assembled with node scripts/build-installers.mjs .artifacts/docker-proof/installers.

The base standalone installer attempted NodeSource provisioning before selecting the git checkout; an apt-get adapter recorded and refused package mutation (provisioning-refused:install ... nodejs). The candidate runs used real Node, SQLite, Corepack/pnpm, dependency installation, builds, and installed CLI verification without those adapters.

Trusted source snapshots were prepared with git archive 3263a51fc3a7 for main and git archive v2026.10.8 for the stricter release. Each was extracted into an isolated git repository, committed, given its requested branch/tag, and assigned a local self-origin so the real installer exercised ref fetch/checkout without downloading repository history. Both complete installs exited 0; both containers were removed by --rm.

Main command inside the container, with HOME=/proof/home-main and OPENCLAW_STATE_DIR=/proof/state-main:

bash /proof/installers/install.sh --install-method git --version main --git-dir /proof/checkout-main --no-git-update --no-onboard --no-prompt
node --version
"$HOME/.local/bin/openclaw" --version

Observed: Node.js v24.21.0 found, no upgrade, OpenClaw installed successfully (2026.10.8)!, caller Node still v24.21.0, installed wrapper reports OpenClaw 2026.10.8.

Stricter-ref command inside a separate fresh container, with HOME=/proof/home-strict and OPENCLAW_STATE_DIR=/proof/state-strict:

bash /proof/installers/install.sh --install-method git --version v2026.10.8 --git-dir /work/checkout --no-onboard --no-prompt
"$HOME/.local/bin/openclaw" --version

Observed: selected v2026.10.8, Node.js v24.21.0 found, upgrading to a supported version, Node.js v24.22.2 installed, active installer runtime /usr/bin/node, OpenClaw installed successfully (2026.10.8)!, installed wrapper reports OpenClaw 2026.10.8. The caller shell remains unchanged, while the wrapper binds the selected compatible runtime.

Read engines.node after selecting the Git checkout, then admit or provision Node before pnpm. Preserve selected npm package requirements and SQLite capability checks in both Bash and PowerShell.

Fixes #187613. Regression from #187564; thanks @McgAtom for the report.
@clawsweeper

clawsweeper Bot commented Oct 29, 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 docs Improvements or additions to documentation scripts Repository scripts size: M labels Oct 29, 2026
@steipete
steipete marked this pull request as ready for review October 29, 2026 11:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T11:53:03.562595Z d3a088c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Local ClawSweeper was unavailable because the shared runner checkout has unrelated edits. Codex autoreview of this change was scoped-clean at P0–P2; regression, Docker, ratchet, and inherited-failure evidence is in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3a088cfc9

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/install.sh
fi
fi

ensure_node "$repo_dir" || return 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve release tags without npm before selecting the checkout

On a fresh host without Node/npm, moving ensure_node after checkout selection makes --install-method git silently install main instead of the default latest release. resolve_git_openclaw_ref in scripts/install-policy.sh still calls installer_npm view openclaw dist-tags.latest and explicitly falls back to main when that command produces no output; explicit next/beta selectors similarly fall through to literal Git refs rather than published release tags. (npm view --help describes the command as “View registry info”.) Previously npm was provisioned before this lookup. Resolve dist-tags through a Node-independent registry lookup before checkout selection so fresh installs retain the requested release while Node admission still uses that checkout’s engines.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR reads Git checkout engines before admitting or provisioning Node in the Bash and PowerShell installers.

Example: Install Git main with Node 24.21.0 and passing SQLite capability checks.

  • Before: The npm fallback floor causes an unnecessary Node upgrade.
  • After: The selected checkout's relaxed engine range retains Node 24.21.0.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful target-aware repair with meaningful Docker evidence, but introduced bootstrap regressions block merging.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A Git installation unnecessarily replaces a runtime that already satisfies the selected source and SQLite requirements.
Reason: The report establishes a concrete regression, and the maintainer-authored direction preserves target requirements through existing provisioning owners.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep open: the target-aware admission fix is useful and maintainer-directed, but moving Node setup after checkout introduces bootstrap failures and incorrect release selection.

Priority: P2
Reviewed head: d3a088cfc91eca4500b2cf47bad1e11437fdc84e

Before merge

  • Remove pre-admission Node dependencies from Git checkout preparation (P1) - On a host without node on PATH, Git installation now reaches checkout preparation before provisioning Node. Bash's clone_git_checkout_transactionally executes node at scripts/install-policy.sh:505, so a fresh clone fails before this ensure_node call. PowerShell fails even earlier: Resolve-GitCheckoutPath invokes the Node-based Resolve-PhysicalDirectoryPath before reaching Ensure-Node. Previously both paths ran after Node provisioning. Make these existing preparation owners work without Node while preserving destination checks, transactional publication, and rollback; otherwise the installer cannot bootstrap its own runtime.
  • Resolve Git release selectors before relying on npm availability (P2) - For an existing checkout with Node available only through an unloaded nvm installation, --install-method git with the default latest selector now calls resolve_git_openclaw_ref before ensure_node loads nvm. Its npm dist-tag lookup fails and returns main, after which runtime setup can succeed and install the wrong source. Explicit beta/next selectors similarly fall through to literal refs. Previously runtime setup made npm available first. Resolve these selectors through a Node-independent registry lookup before checkout selection, retaining checkout-specific engine admission afterward. This confirms the concern at fix(install): use the git target's own engines instead of the npm fallback floor #187635 (comment).
  • Explain or restore the original intent of Node setup ordering before Git operations - 076a8cc: Transactional checkout publication and physical-path resolution use Node to preserve destinations and recover failed clones.

Findings

  • [P1] Remove pre-admission Node dependencies from Git checkout preparation — scripts/install.sh:2984
  • [P2] Resolve Git release selectors before relying on npm availability — scripts/install.sh:3877-3879

Provenance

  • Node setup ordering before Git operations changes intended behavior without addressing why it exists (076a8cc: Transactional checkout publication and physical-path resolution use Node to preserve destinations and recover failed clones.)

Tests

  • Missing end-to-end proof: The supplied Docker runs do not cover Node-less Git bootstrap or an upgrade from the latest stable installation with settings and data intact.
Agent review details

How this fits together

The standalone installers turn an installation method and version selector into a checkout or package, select a compatible runtime, build or install OpenClaw, and publish its launcher.

flowchart TD
 A[Installation request] --> B[Select package or Git checkout]
 B --> C[Read target engines]
 C --> D[Admit or provision Node]
 D --> E[Install dependencies and build]
 E --> F[Verify CLI and publish launcher]
Loading

Technical review

Best possible solution:

Keep checkout-specific admission in the existing provisioning owners while making preceding checkout preparation and release-tag resolution independent of Node and npm.

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

Current-main source establishes the strict fallback leak, and the linked report supplies a real-runtime reproduction; this read-only review executed no installer or tests.

Is this the best way to solve the issue?

Reading the selected checkout fixes the correct admission owner, but the smallest complete repair must also eliminate Node/npm dependencies before that admission without weakening transactional checkout safety.

Full review comments:

  • [P1] Remove pre-admission Node dependencies from Git checkout preparation — scripts/install.sh:2984
    On a host without node on PATH, Git installation now reaches checkout preparation before provisioning Node. Bash's clone_git_checkout_transactionally executes node at scripts/install-policy.sh:505, so a fresh clone fails before this ensure_node call. PowerShell fails even earlier: Resolve-GitCheckoutPath invokes the Node-based Resolve-PhysicalDirectoryPath before reaching Ensure-Node. Previously both paths ran after Node provisioning. Make these existing preparation owners work without Node while preserving destination checks, transactional publication, and rollback; otherwise the installer cannot bootstrap its own runtime.
    Confidence: 0.99
  • [P2] Resolve Git release selectors before relying on npm availability — scripts/install.sh:3877-3879
    For an existing checkout with Node available only through an unloaded nvm installation, --install-method git with the default latest selector now calls resolve_git_openclaw_ref before ensure_node loads nvm. Its npm dist-tag lookup fails and returns main, after which runtime setup can succeed and install the wrong source. Explicit beta/next selectors similarly fall through to literal refs. Previously runtime setup made npm available first. Resolve these selectors through a Node-independent registry lookup before checkout selection, retaining checkout-specific engine admission afterward. This confirms the concern at fix(install): use the git target's own engines instead of the npm fallback floor #187635 (comment).
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 62af09f9ae0c.

Provenance checked

  • Target-package engine admission keeps the original intent (5598c3d: Published npm releases retained stricter engines than main, requiring target-aware admission and a conservative metadata fallback.)
  • Existing runtime and nvm preservation keeps the original intent (0749882: Keep compatible active runtimes and avoid replacing an existing nvm installation or silently changing its defaults.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs test/scripts/install-sh.test.ts test/scripts/install-ps1.release.test.ts test/scripts/install-ps1.test.ts --maxWorkers=1
  • node scripts/run-vitest.mjs test/scripts/standalone-installers.test.ts test/scripts/install-git-ref.test.ts --maxWorkers=1
  • bash -n scripts/install.sh
  • bash -n scripts/install-policy.sh
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5598c3d adds scripts/install.sh:1635 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5598c3d76bcb; files: scripts/install.sh)

PR surface

Tests +70, Docs 0, Other +21. Total +91 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 70 0 +70
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 79 58 +21
Total 5 150 59 +91

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #187613
Summary: This PR is a checkout-aware candidate fix for the canonical Git runtime-admission report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: This fixes unnecessary provisioning in the advanced Git-install workflow and needs focused bootstrap repairs before merging.
  • add merge-risk: 🚨 compatibility: The reordered flow breaks Git installation without Node on PATH and can change the requested latest release into main.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This fixes unnecessary provisioning in the advanced Git-install workflow and needs focused bootstrap repairs before merging.
  • merge-risk: 🚨 compatibility: The reordered flow breaks Git installation without Node on PATH and can change the requested latest release into main.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 29, 2026, 8:01 AM ET / 12:01 UTC.

@steipete
steipete merged commit eb6ba5c into main Oct 29, 2026
186 of 189 checks passed
@steipete
steipete deleted the fix/install-git-target-engines-187613 branch October 29, 2026 12:07
steipete added a commit that referenced this pull request Oct 29, 2026
…ting success (#187688)

After #187635 moved runtime admission, ensure_node is called from a conditional, which disables bash's implicit failure handling inside install_homebrew. A failed Homebrew bootstrap therefore printed 'Homebrew installed' and went on to brew install node. The installer now propagates the bootstrap status explicitly through quiet and verbose modes and both installer entry paths, so it stops with the original exit status before any success output or Node provisioning.

Fixes #187678. Thanks @McgAtom for the report.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…lback floor (openclaw#187635)

openclaw#187564 made the installers honor the target release's engines.node, but git installs never resolved one and kept the conservative npm fallback floor, so a Git main install upgraded a Node 24.21.0 that main accepts. Bash and PowerShell installers now read the selected checkout's engines.node after ref selection and before pnpm; npm installs keep the published package's engines. Docker proof: git main retains Node 24.21.0, git v2026.10.8 upgrades to 24.22.2.

Fixes openclaw#187613. Thanks @McgAtom for the report.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…ting success (openclaw#187688)

After openclaw#187635 moved runtime admission, ensure_node is called from a conditional, which disables bash's implicit failure handling inside install_homebrew. A failed Homebrew bootstrap therefore printed 'Homebrew installed' and went on to brew install node. The installer now propagates the bootstrap status explicitly through quiet and verbose modes and both installer entry paths, so it stops with the original exit status before any success output or Node provisioning.

Fixes openclaw#187678. Thanks @McgAtom for the report.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. docs Improvements or additions to documentation scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git main installer upgrades a runtime that passes source and SQLite requirements

1 participant