Skip to content

fix(installer): avoid checking out the wrong Git ref during pinned installs - #130907

Merged
obviyus merged 9 commits into
openclaw:mainfrom
jason-allen-oneal:codex/update-exact-git-fetch
Aug 28, 2026
Merged

obviyus merged 9 commits into
openclaw:mainfrom
jason-allen-oneal:codex/update-exact-git-fetch

Conversation

@jason-allen-oneal

@jason-allen-oneal jason-allen-oneal commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

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 main rebase 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.

main updates now refresh refs/remotes/origin/main explicitly. 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 main while 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

  • Exact current main: 944cff7cefe25c9d919b42e7d82200a3cb98d13a.
  • Exact PR head: 68b5bcc182b909407c6395dc63688349a9fc5078.
  • The same real POSIX driver ran both scripts/install-cli.sh and scripts/install.sh against both revisions with separate bare Git remotes and unique commit markers.
  • Current main selected the colliding branch in both installers and hid a conflicting rebase while leaving UU state.txt.
  • The PR head selected the qualified tag commit, carried immutable, and chose --frozen-lockfile.
  • The PR head fell back to a v-prefixed branch only when the tag was absent, carried moving, and chose --no-frozen-lockfile.
  • Moving-main refresh and clean rebase passed in both installers.
  • Conflicting rebase failed only after both installers restored the original HEAD and porcelain state, preserved user-note.txt, and cleared rebase-merge and rebase-apply.
  • A rejecting pre-rebase hook 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.
  • Every new bare-Git fixture removes its temporary repository on 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, and git diff --check: passed.
  • Production installer delta: +154/-61, net +93. The branch keeps two mirrored implementations because each POSIX installer must run as a standalone downloaded script; the ordered flow remains smaller than the contributor version.
  • No local build or type check ran on this host. Exact-head GitHub CI owns those checks.

@clawsweeper

clawsweeper Bot commented Aug 27, 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 triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 27, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 3:56 PM ET / 19:56 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: 68b5bcc182b909407c6395dc63688349a9fc5078

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-backed installer repair with credible real Git behavior evidence and mirrored regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed production checkout owners in both POSIX scripts are exercised by real bare-Git remotes with distinct commits; the supplied after-fix results cover tag preference, branch fallback, tracking-ref refresh, conflict recovery, and hook-refused rebases.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed production checkout owners in both POSIX scripts are exercised by real bare-Git remotes with distinct commits; the supplied after-fix results cover tag preference, branch fallback, tracking-ref refresh, conflict recovery, and hook-refused rebases.
Evidence reviewed 6 items Current-main defect: Current main checks a branch before tags and ignores failed rebases in the POSIX checkout owner; the installer subsequently continues to dependency installation and build.
Introduced repair: The PR qualifies tag and branch lookups, prioritizes tags for normalized release selectors, and verifies recovery after a failed rebase.
Sibling coverage: The mirrored install.sh owner has the same qualified-ref and recovery flow, with Git fixtures for collision, fallback, conflict, and hook-refusal cases.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

  • Resolve merge risk (P1) - Merging intentionally changes existing source installs from continuing after a failed main rebase to stopping with a verified recovery result; exact-head CI should complete before landing.
  • Resolve merge risk (P1) - Production code grows by 93 lines across two independently downloadable installer scripts; the duplication is justified by their standalone distribution but remains compatibility-sensitive.
Agent review details

Security

None.

PR surface

Tests +450, Other +93. Total +543 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 490 40 +450
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 154 61 +93
Total 4 644 101 +543

Review metrics

Metric Value Why it matters
Production versus test delta production +93 net; tests +450 net The production increase is mirrored across standalone downloaded installers and is covered by real Git fixtures in both suites.

Merge-risk options

Maintainer options:

  1. Retain verified failure semantics (recommended)
    Accept the intentional compatibility change that a failed main rebase now stops the install instead of building from a potentially conflicted checkout.

Technical review

Best 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.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed production checkout owners in both POSIX scripts are exercised by real bare-Git remotes with distinct commits; the supplied after-fix results cover tag preference, branch fallback, tracking-ref refresh, conflict recovery, and hook-refused rebases.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Wrong pinned-source bytes and a false successful update can affect active source-install workflows.
  • merge-risk: 🚨 compatibility: Existing source installations now fail explicitly after an unrecoverable or unverified main rebase rather than continuing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 changed production checkout owners in both POSIX scripts are exercised by real bare-Git remotes with distinct commits; the supplied after-fix results cover tag preference, branch fallback, tracking-ref refresh, conflict recovery, and hook-refused rebases.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production checkout owners in both POSIX scripts are exercised by real bare-Git remotes with distinct commits; the supplied after-fix results cover tag preference, branch fallback, tracking-ref refresh, conflict recovery, and hook-refused rebases.

Evidence

What I checked:

  • Current-main defect: Current main checks a branch before tags and ignores failed rebases in the POSIX checkout owner; the installer subsequently continues to dependency installation and build. (scripts/install-cli.sh:1036, bb51e903325f)
  • Introduced repair: The PR qualifies tag and branch lookups, prioritizes tags for normalized release selectors, and verifies recovery after a failed rebase. (scripts/install-cli.sh:1020, 68b5bcc182b9)
  • Sibling coverage: The mirrored install.sh owner has the same qualified-ref and recovery flow, with Git fixtures for collision, fallback, conflict, and hook-refusal cases. (test/scripts/install-sh.test.ts:3701, 68b5bcc182b9)
  • Git contract: The local Git CLI documents that ls-remote --exit-code returns 2 when no matching ref is found, matching the PR’s explicit fallback handling. (scripts/install.sh:2694, 68b5bcc182b9)
  • History and current ownership: The current repair head is the hook-refusal recovery commit; current-main history identifies recent installer work by Peter Steinberger, while the PR’s latest revisions are by Ayaan Zaidi. (scripts/install-cli.sh:1020, 68b5bcc182b9)
  • Proof supplied: The PR body records real POSIX Git-fixture runs against main and the PR head, including tag/branch selection and rebase recovery, plus the focused Vitest command reporting 238 passing tests. (test/scripts/install-cli.test.ts:1012, 68b5bcc182b9)

Likely related people:

  • Peter Steinberger: Recent current-main history on both POSIX installer owners includes installer reliability work. (role: recent installer-area contributor; confidence: medium; commits: fa57231562da, 83dce46a7da4; files: scripts/install-cli.sh, scripts/install.sh)
  • Ayaan Zaidi: Authored the current head’s ref-selection consolidation and hook-refusal recovery revision. (role: latest repair author; confidence: high; commits: bcf27b5d7adb, 68b5bcc182b9; files: scripts/install-cli.sh, scripts/install.sh)

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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-27T19:18:04.630Z sha 2cc90b0fd48d678f478f80d5bd13e9bfa7644021 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-27T20:03:51.134Z sha 2cc90b0fd48d678f478f80d5bd13e9bfa7644021 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T21:33:32.304Z sha c834683639309c84b0fa6c406e3738bfadaf9342 :: needs real behavior proof before merge. :: [P1] Prioritize resolved release tags over matching branches
  • reviewed 2026-08-27T21:50:10.579Z sha c834683639309c84b0fa6c406e3738bfadaf9342 :: needs real behavior proof before merge. :: [P1] Prioritize resolved release tags over matching branches
  • reviewed 2026-08-27T23:46:02.151Z sha 90666f23229af184f837c4398b1a931b257b78cf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T16:42:32.242Z sha 4abf5943be69c9da1abb0591163bb8bfa3350348 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T18:27:58.575Z sha bcf27b5 :: needs changes before merge. :: [P2] Clean up the Git fixture directories
  • reviewed 2026-08-28T18:46:16.505Z sha 6c379fa :: needs changes before merge. :: [P2] Handle hook-refused rebases without a false recovery warning

@jason-allen-oneal
jason-allen-oneal marked this pull request as ready for review August 27, 2026 14:58
@jason-allen-oneal jason-allen-oneal changed the title fix(installer): resolve git refs exactly fix(installer): avoid checking out the wrong Git ref during pinned installs Aug 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 27, 2026
@jason-allen-oneal

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 27, 2026
@jason-allen-oneal

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 27, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 27, 2026
@clawsweeper clawsweeper Bot added the rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. label Aug 28, 2026
@obviyus
obviyus force-pushed the codex/update-exact-git-fetch branch from 4abf594 to bcf27b5 Compare August 28, 2026 18:18
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 28, 2026
@clawsweeper clawsweeper Bot added 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 28, 2026
@obviyus

obviyus commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks @jason-allen-oneal!

Proof: On exact head 68b5bcc182b909407c6395dc63688349a9fc5078, both POSIX installers ran against separate bare Git remotes with distinct commits for a same-name release tag and branch. They selected the tag, used the branch only when the tag was absent, refreshed moving main, completed a clean rebase, restored a conflicting rebase, and verified unchanged state when a pre-rebase hook refused before rebase metadata existed. Exact-head CI run 33205490096 is green. Local ClawSweeper passed with no findings, security concerns, decisions, or Rank-up moves.

  • Bug: A pinned source install could build a same-name branch instead of the requested release tag, and a failed rebase could appear to continue with conflicts.
  • Fix: Both installer owners now resolve qualified refs in one ordered flow, carry ref mutability into lockfile selection, and abort only an active rebase before verifying the saved checkout state.
  • Cleanup: All ten new Git fixtures remove their temporary repositories on exit; the temp-creation report found no warning.
  • Validation: node scripts/run-vitest.mjs test/scripts/install-cli.test.ts test/scripts/install-sh.test.ts passed 238 tests; 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, pnpm lint:scripts, and git diff --check passed.
  • Scope: Production changes are +154/-61, net +93 across two standalone downloaded installers. No known proof gap remains.

Example

Before After
v2026.8.28 could select the same-name branch. v2026.8.28 selects refs/tags/v2026.8.28.
A conflicting main rebase could return success with UU state.txt. The installer restores the original checkout and returns a clear failure.
A hook refusal could advise an impossible rebase --abort. The installer verifies the unchanged checkout without false abort guidance.

@obviyus
obviyus merged commit a939d4b into openclaw:main Aug 28, 2026
195 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
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]>
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. P1 High-priority user-facing bug, regression, or broken workflow. 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: L 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