Skip to content

fix(installer): honor explicit git target inside another checkout - #128407

Merged
steipete merged 3 commits into
openclaw:mainfrom
TurboTheTurtle:fix/install-git-dir-precedence-127361
Aug 25, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
TurboTheTurtle:fix/install-git-dir-precedence-127361

Conversation

@TurboTheTurtle

@TurboTheTurtle TurboTheTurtle commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Running the POSIX installer from an existing OpenClaw checkout silently replaced an explicit --git-dir, --dir, or OPENCLAW_GIT_DIR destination with the checkout detected from the current working directory. The install plan advertised the requested directory, but dependencies, builds, the installed wrapper, and final checkout summary all belonged to the wrong directory.

Related #127361.

Repair

Record whether the checkout target was explicitly supplied when reading the environment and parsing CLI options. Prefer that explicit target over current-directory detection; preserve automatic checkout reuse when no nonempty target was supplied, including the existing empty-option behavior. CLI options continue to override the environment, and repeated options retain last-value precedence.

Use the existing final_git_dir as the single authoritative target for installation and the final operator summary, and remove the redundant single-use default variable and duplicate temporary target. Production delta: +7/-7 lines (net zero).

Evidence

  • Regression-first installer-boundary coverage: six existing-main failures became eight passing cases covering CLI over environment, --dir, spaces, environment-only targets, an explicit path equal to the computed default, repeated flags, relative paths, implicit checkout reuse, and empty-target compatibility.
  • Both POSIX installer suites pass: node scripts/run-vitest.mjs test/scripts/install-sh.test.ts test/scripts/install-cli.test.ts (218 tests).
  • pnpm lint:scripts, targeted formatting checks, and bash -n scripts/install.sh pass.
  • Two independent maintainers reviewed the exact committed source; separate structured Codex review found no actionable P0/P1/P2 issues.
  • The full remote changed-file gate could not start because its Blacksmith checkout synchronization timed out before running any checks; hosted exact-head PR CI is the clean-environment gate.

Actual standalone-installer reproduction used two real, separate checkout-shaped directories with spaces, an isolated HOME, the normal Bash entrypoint, a real Node runtime and generated launcher, and fail-closed local package-manager/Git shims that disallowed network or repository mutation:

$ cd 'checkout A'
$ OPENCLAW_GIT_DIR='ignored env' bash install.sh --install-method git --git-dir 'checkout B' --no-git-update --no-onboard

# Before:
Git directory: .../checkout B
Detected checkout: .../checkout A
Installing OpenClaw from git checkout: .../checkout A
pnpm -C '.../checkout A' install --no-frozen-lockfile
OpenClaw installed successfully (2026.8.23-proof)!
Checkout: .../checkout A

# After:
Git directory: .../checkout B
Detected checkout: .../checkout A
Installing OpenClaw from git checkout: .../checkout B
pnpm -C '.../checkout B' install --no-frozen-lockfile
OpenClaw installed successfully (2026.8.23-proof)!
Checkout: .../checkout B

# Environment-only selection also builds and reports checkout B.
# Commands targeting checkout A after the fix: 0.
# Blocked network or repository mutation commands: 0.

Original fix and regression direction by @TurboTheTurtle; contributor credit is preserved in the commit trailer.

@clawsweeper

clawsweeper Bot commented Aug 23, 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 scripts Repository scripts size: S labels Aug 23, 2026
@TurboTheTurtle
TurboTheTurtle marked this pull request as ready for review August 23, 2026 23:18
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 2:09 PM ET / 18:09 UTC.

ClawSweeper review

What this changes

The PR makes the POSIX installer honor an explicit Git checkout target instead of replacing it with the checkout detected from the caller’s directory.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding: this is a focused repair for a current-main installer bug, with a coherent precedence rule and boundary coverage. Keep it open for normal exact-head CI and maintainer handling.

Priority: P2
Reviewed head: 51402ed9440fbbb461f5c8a720ca14554e60cc3d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly scoped, boundary-covered, and supported by a direct installer transcript.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body contains an after-fix real Bash-entrypoint transcript with separate checkout-shaped directories and shows installation and final reporting move from checkout A to the explicit checkout B.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body contains an after-fix real Bash-entrypoint transcript with separate checkout-shaped directories and shows installation and final reporting move from checkout A to the explicit checkout B.
Evidence reviewed 6 items Current-main root cause: Current main initializes the requested Git directory, then unconditionally replaces the installation target with a detected checkout whenever one exists.
Repair uses one authoritative target: The PR records nonempty explicit selection, lets detected-checkout reuse apply only without that marker, and passes the same final target to Git installation and the final summary.
Boundary regression coverage: The added table drives the real Bash main flow through CLI-over-environment, alias, spaces, environment-only, repeated, relative, implicit, and empty-selector cases before observing the selected installation target.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs test/scripts/install-sh.test.ts -t 'selects the git install target'

Result: PASS (completed)

[test] starting test/vitest/vitest.tooling.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128407-1M0okF/target

 ✓  tooling  test/scripts/install-sh.test.ts (149 tests | 141 skipped) 201ms

 Test Files  1 passed (1)
      Tests  8 passed | 141 skipped (149)
   Start at  18:10:19
   Duration  763ms (transform 313ms, setup 67ms, import 101ms, tests 201ms, environment 0ms)

[test] passed 1 Vitest shard in 6.93s
[test] starting test/vitest/vitest.tooling.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128407-1M0okF/target

 ✓  tooling  test/scripts/install-sh.test.ts (149 tests | 141 skipped) 198ms

 Test Files  1 passed (1)
      Tests  8 passed | 141 skipped (149)
   Start at  18:10:28
   Duration  512ms (transform 76ms, setup 30ms, import 35ms, tests 198ms, environment 0ms)

[test] passed 1 Vitest shard in 6.75s

Assertions:

  • NOT OBSERVED expect_output: selects the git install target — command exited successfully; expected output was not observed in the captured pane

How this fits together

The POSIX installer combines environment and command-line checkout selectors with current-directory checkout detection, then chooses one target for installation. That target controls dependency installation, builds, launcher creation, and the final source-install summary.

flowchart LR
  A[Environment selector] --> C[Parse installer options]
  B[Command-line selector] --> C
  D[Current-directory checkout] --> E[Detect checkout]
  C --> F[Choose Git installation target]
  E --> F
  F --> G[Install build and launcher]
  G --> H[Final source-install summary]
Loading

Before merge

  • Resolve merge risk (P1) - This intentionally changes target precedence for existing scripted Git installs; exact-head installer CI should confirm explicit selectors and implicit checkout reuse before merge.
  • Complete next step (P2) - No actionable patch defect remains; this PR needs ordinary exact-head CI completion and maintainer review.
Agent review details

Security

None.

PR surface

Tests +78, Other 0. Total +78 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 78 0 +78
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 7 7 0
Total 2 85 7 +78

Review metrics

Metric Value Why it matters
Production versus test delta production +7/-7 (net 0); tests +78 The repair reshapes the existing target-selection flow without production growth and adds focused precedence coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #127361
Summary: This PR is the concrete candidate repair for the explicitly linked installer-target bug.

Members:

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

Merge-risk options

Maintainer options:

  1. Complete exact-head installer validation (recommended)
    Merge after the pending exact-head installer checks confirm both explicit target selection and implicit detected-checkout reuse.

Technical review

Best possible solution:

Retain one explicit-target precedence rule in the POSIX installer, while preserving detected-checkout reuse only when no nonempty target was supplied.

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

Yes—current main has a direct source-reproducible path: run a Git install from checkout A while selecting checkout B, and the unconditional detected-checkout assignment selects A.

Is this the best way to solve the issue?

Yes—the explicit-selection marker is the narrow owner-boundary fix; it avoids a downstream workaround and preserves the documented no-selector convenience behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The installer can build or update the wrong requested checkout, but the defect has a bounded repair and does not make the core runtime unavailable.
  • merge-risk: 🚨 compatibility: Changing Git-target precedence can affect existing automation that runs the installer from inside a checkout.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body contains an after-fix real Bash-entrypoint transcript with separate checkout-shaped directories and shows installation and final reporting move from checkout A to the explicit checkout B.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains an after-fix real Bash-entrypoint transcript with separate checkout-shaped directories and shows installation and final reporting move from checkout A to the explicit checkout B.

Evidence

What I checked:

  • Current-main root cause: Current main initializes the requested Git directory, then unconditionally replaces the installation target with a detected checkout whenever one exists. (scripts/install.sh:3778, e06e80495550)
  • Repair uses one authoritative target: The PR records nonempty explicit selection, lets detected-checkout reuse apply only without that marker, and passes the same final target to Git installation and the final summary. (scripts/install.sh:3779, 51402ed9440f)
  • Boundary regression coverage: The added table drives the real Bash main flow through CLI-over-environment, alias, spaces, environment-only, repeated, relative, implicit, and empty-selector cases before observing the selected installation target. (test/scripts/install-sh.test.ts:1468, 51402ed9440f)
  • Documented selector contract: Installer help presents --git-dir/--dir as the checkout-directory selector, so allowing detected reuse to overwrite it is inconsistent with the exposed interface. (scripts/install.sh:1412, e06e80495550)
  • Feature-history provenance: Current-main blame attributes the overwritten-target block to the recent installer-history commit; the linked issue and PR context identify steipete as the repair investigator and author of the substantive fix commit. (scripts/install.sh:3778, 147e9da5d8b5)
  • Release status: The repair remains an open, unmerged PR; no release provenance exists for its head. (51402ed9440f)

Likely related people:

  • Peter Steinberger: Current-main blame for the overwritten-target block points to this recent installer-history commit. (role: recent installer contributor; confidence: medium; commits: 147e9da5d8b5; files: scripts/install.sh)
  • steipete: The linked canonical report documents the target-selection investigation, and the PR context attributes the substantive repair commit to steipete. (role: repair investigator and recent area contributor; confidence: medium; commits: d613aa572dc9; files: scripts/install.sh, test/scripts/install-sh.test.ts)

Rank-up moves

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

  • Let exact-head installer CI complete before merge.

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-23T23:26:05.260Z sha a39513c31b4773f5dda2a203585f94d409f5c59b :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-23T23:47:15.619Z sha a39513c31b4773f5dda2a203585f94d409f5c59b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T17:29:52.731Z sha d613aa5 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@steipete
steipete force-pushed the fix/install-git-dir-precedence-127361 branch from a39513c to d613aa5 Compare August 25, 2026 17:22
@openclaw-barnacle openclaw-barnacle Bot added 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 25, 2026
@steipete
steipete merged commit 6831959 into openclaw:main Aug 25, 2026
178 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants