Repository navigation
fix(installer): avoid checking out the wrong Git ref during pinned installs - #130907
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 3:56 PM ET / 19:56 UTC. ClawSweeper reviewWhat this changesThe PR makes both POSIX source installers prefer an exact release tag over a same-named branch and stop safely after a failed main-branch rebase. Merge readinessKeep open. Current main still has the POSIX branch-first checkout and ignored-rebase paths; this focused PR repairs both and addresses the prior hook-refusal finding without a new blocking defect. Priority: P1 Review scores
Verification
How this fits togetherThe downloaded POSIX installers resolve an operator’s requested Git version, prepare a local OpenClaw checkout, then install dependencies and build the CLI. This change controls which checkout reaches that build step and how a failed update is reported. flowchart LR
A[Operator version request] --> B[POSIX installer]
B --> C[Qualified Git ref lookup]
C --> D[Checked-out source tree]
D --> E[Dependency installation]
E --> F[CLI build and wrapper]
B --> G[Verified rebase recovery]
G --> D
Before merge
Agent review detailsSecurityNone. PR surfaceTests +450, Other +93. Total +543 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the paired POSIX repair once exact-head checks are green, while retaining the separate Windows work tracked by #127411. Do we have a high-confidence way to reproduce the issue? Yes. The supplied real Git-fixture runs reproduce the colliding-ref and failed-rebase paths, and current main retains the implicated POSIX source code. Is this the best way to solve the issue? Yes. Qualifying refs at the installer owner, carrying the selected ref’s mutability into lockfile choice, and verifying state after rebase failure is the narrowest maintainable repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb51e903325f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4abf594 to
bcf27b5
Compare
|
Thanks @jason-allen-oneal! Proof: On exact head
Example
|
Source installs must select the requested release commit and leave existing checkouts recoverable when updates fail. This change qualifies Git refs, carries ref mutability into lockfile selection, restores conflicting rebases, and verifies unchanged state when a pre-rebase hook refuses before rebase metadata exists. Co-authored-by: Jason O'Neal <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A source install can request a pinned release tag but check out a same-name branch instead. An existing source checkout can also hide a failed
mainrebase and continue with conflicts.Related: #127352
Related: #127411
Why This Change Was Made
Both POSIX installers now use one ordered ref-resolution flow. Release-shaped selectors check the qualified tag first, then fall back to a branch only when the tag is absent. Other selectors retain branch-first behavior.
The selected ref kind is carried into lockfile selection, so tag installs stay frozen and moving branches remain updateable without a second remote lookup.
mainupdates now refreshrefs/remotes/origin/mainexplicitly. A failed rebase aborts and verifies the original HEAD, porcelain state, and cleared rebase metadata before the installer reports a safe failure.AI-assisted disclosure: This PR was prepared with Codex. The contributor reviewed and understood the original change. Maintainer verification rebased and simplified it against current
mainwhile preserving the intended behavior and contributor credit.User Impact
Pinned source installs select the requested release commit even when a branch has the same name. Moving branches still work when no matching release tag exists. Failed updates stop only after the original checkout is restored, or report that recovery could not be verified.
Evidence
944cff7cefe25c9d919b42e7d82200a3cb98d13a.68b5bcc182b909407c6395dc63688349a9fc5078.scripts/install-cli.shandscripts/install.shagainst both revisions with separate bare Git remotes and unique commit markers.UU state.txt.immutable, and chose--frozen-lockfile.moving, and chose--no-frozen-lockfile.user-note.txt, and clearedrebase-mergeandrebase-apply.pre-rebasehook failed with the saved HEAD and porcelain state verified, no rebase metadata present, and no impossible abort advice.node scripts/run-vitest.mjs test/scripts/install-cli.test.ts test/scripts/install-sh.test.ts: 238 tests passed.EXIT; the repository temp-creation report found no new warning.pnpm format:check --no-error-on-unmatched-pattern -- scripts/install-cli.sh scripts/install.sh test/scripts/install-cli.test.ts test/scripts/install-sh.test.ts: passed.pnpm lint:scripts, repository guards, andgit diff --check: passed.