Repository navigation
Description
Summary
When the full POSIX installer runs from inside any OpenClaw checkout, its Git path unconditionally replaces the configured GIT_DIR with the checkout detected from $PWD. This overrides both explicit --git-dir and OPENCLAW_GIT_DIR, so the installer mutates/builds the caller's current checkout instead of the requested target.
A no-network source harness at frozen a434545620127a3105699513d662395a43b43eb1 set a distinct requested directory, ran main() from an OpenClaw checkout, and observed:
selected=/home/user/workspace/repo
Current main was rechecked and still unconditionally assigns repo_dir="$detected_checkout" after initializing repo_dir="$GIT_DIR".
Deterministic sequence
cd /srv/openclaw-a
./scripts/install.sh --git --git-dir /srv/openclaw-bEquivalent environment form:
cd /srv/openclaw-a
OPENCLAW_GIT_DIR=/srv/openclaw-b ./scripts/install.sh --gitIn both cases, checkout A is selected/mutated/built and checkout B is ignored.
Owner / contract
scripts/install.shinitializesGIT_DIRfromOPENCLAW_GIT_DIRor the default.- Argument parsing assigns
--git-dirinto the same variable. main()detects an OpenClaw checkout from$PWD.- Git installation starts with
repo_dir="$GIT_DIR"but then unconditionally replaces it when a checkout was detected. - Installer docs advertise both selectors as explicit checkout-directory controls; environment docs say explicit path overrides retain precedence.
- The dedicated-prefix POSIX installer and Windows path do not perform this substitution.
Current tests cover lower-level Git installation and CLI/env paths, but not main() with an unrelated valid OpenClaw $PWD.
Targeted live issue/PR searches found no exact existing root.
Suggested repair
Track whether the Git target was explicitly supplied by nonempty OPENCLAW_GIT_DIR or --git-dir. Reuse detected_checkout only when no explicit target exists. CLI should retain precedence over environment if both are supplied according to existing option policy.
Regression
At the main() boundary, run from checkout A while requesting checkout B through:
--git-dir;OPENCLAW_GIT_DIR;- no explicit target (where detected A may remain the intended convenience).
Stub mutation/build callees and assert only the intended directory is selected.
Risk
Review required, medium installer-precedence impact. The current behavior can update/build the wrong checkout while reporting success and leaving the explicitly requested owner untouched.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Aug 21, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed August 25, 2026, 6:34 AM ET / 10:34 UTC.
Summary
Keep open: current main still replaces the explicit Git target with the detected caller checkout, and the protected issue has a focused open repair PR that formally owns the fix.
Reproducibility: yes. Current main sets an explicit target and then unconditionally replaces it when checkout detection succeeds; this owner-boundary defect is directly traceable from source.
Next step
The formally linked open repair already owns this focused fix, and the maintainer label requires human review rather than a duplicate automation job.
Review details
Best possible solution:
Land the linked repair with regression coverage for CLI, environment, and no-explicit-target cases, retaining checkout detection only as the convenience fallback.
Do we have a high-confidence way to reproduce the issue?
Yes. Current main sets an explicit target and then unconditionally replaces it when checkout detection succeeds; this owner-boundary defect is directly traceable from source.
Is this the best way to solve the issue?
Yes. Using the detected checkout only when no nonempty explicit target was supplied restores the contract without removing the convenience fallback.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning high; reviewed against 837b89a0e75c.
Label changes
Label justifications:
P2: The defect can update and build the wrong checkout, but is bounded to the Git installer path.impact:other: An explicit installer destination can be silently replaced by the caller checkout.maturity:stable: The documented installer contract is primarily owned by the M4 Stable CLI Setup surface.Evidence reviewed
What I checked:
scripts/install.sh:3777, 837b89a0e75c)docs/install/installer.md. (docs/install/installer.md:156, 837b89a0e75c)test/scripts/install-sh.test.ts:1637, 837b89a0e75c)scripts/install.sh:3777, 6f4b9a28cf2e)qa/maturity-scores.yaml, 837b89a0e75c)Likely related people:
scripts/install.sh)scripts/install.sh)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.steipete commentedon Aug 25, 2026
Fixed in #128407 (6831959): the standalone installer now honors explicit --git-dir/--dir and OPENCLAW_GIT_DIR, selecting the requested checkout B instead of mutating detected checkout A. Real before-and-after installer runs confirm both CLI and environment-variable selection leave A untouched and correctly build/report B; all 218 installer tests pass.