Skip to content

fix(install): reject commit-less git checkouts - #113809

Merged
steipete merged 5 commits into
openclaw:mainfrom
ooiuuii:fix/install-recover-incomplete-git-checkout
Aug 2, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
ooiuuii:fix/install-recover-incomplete-git-checkout

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Git install destinations that contain .git but whose HEAD does not resolve to an existing commit object are currently accepted as reusable checkouts. Interrupted or damaged clones can therefore continue into update and build operations and fail later with misleading errors.

Fixes #113808.

Why This Change Was Made

All three official Git install paths now validate the selected checkout before update, checkout, or build work:

  • scripts/install.sh
  • scripts/install-cli.sh
  • scripts/install.ps1

The validation pins --git-dir and --work-tree so Git cannot walk into a parent repository, and resolves HEAD^{commit} so a dangling ref or missing object is rejected. The installers stop with recovery guidance and do not delete or move the checkout because it may contain recoverable objects, refs, or user files.

User Impact

Users retrying a Git installation after an interrupted or damaged clone receive the actual cause immediately while their existing directory is preserved. Valid Git checkouts and first-time destinations are unchanged.

Evidence

Final head: 3b2147f2dfc35c34b600246ab31fe2093a4cb67f, rebased without conflicts onto 17a8961a6a36e0bab0a56a248e9c79372ddff402.

Real behavior

The probes used real Git repositories. The invalid fixture was nested inside a valid parent repository and had a syntactically valid branch ref whose commit object was absent. Each guard rejected the nested damaged checkout without touching its marker file; valid controls remained accepted.

scripts/install.sh:     invalid=1 valid=0 marker=kept
scripts/install-cli.sh: invalid=1         marker=kept
scripts/install.ps1:    invalid=1 valid=0 marker=kept

The PowerShell result was produced by parsing and invoking the exact Assert-GitCheckoutHasCommit function from scripts/install.ps1, not a rewritten copy.

A direct Git control demonstrates why the final peel is required:

git rev-parse --verify --quiet HEAD          -> exit 0
git rev-parse --verify --quiet HEAD^{commit} -> exit 1

Focused tests

node scripts/run-vitest.mjs test/scripts/install-ps1.test.ts
Test Files  1 passed (1)
Tests       31 passed (31)
oxfmt --check test/scripts/install-cli.test.ts test/scripts/install-sh.test.ts test/scripts/install-ps1.test.ts
All matched files use the correct format.

Both changed shell installers also pass bash -n, and git diff --check is clean.

Canonical hosted delivery path

The repository copies changed by this PR are the canonical installer sources. .github/workflows/website-installer-sync.yml is triggered whenever any of these three files changes. After its static, Linux Docker, macOS, and Windows jobs pass, the sync-website job runs on pushes to main and copies these exact sources into the hosted repository:

cp openclaw/scripts/install.sh     openclaw.ai/public/install.sh
cp openclaw/scripts/install-cli.sh openclaw.ai/public/install-cli.sh
cp openclaw/scripts/install.ps1    openclaw.ai/public/install.ps1

The workflow then validates the synced website assets, builds the website, commits them, and pushes openclaw.ai/main (sync implementation). Therefore a separate contributor patch to openclaw/openclaw.ai would duplicate generated output and race the canonical sync.

Current Website Installer Sync run 30462223171:

static:            success
linux-docker:      success
macos-installer:   success
windows-installer: success
sync-website:      skipped on pull_request (runs after merge on push to main)

Review

Final-patch autoreview reported:

trufflehog: clean
findings: []
overall: patch is correct (0.91)

The clean review ran immediately before the current-main rebase. git range-diff reports all five commits as exact (=) matches after the rebase, and the focused tests were rerun on the final head.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Jul 25, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 8:24 PM ET / August 1, 2026, 00:24 UTC.

ClawSweeper review

What this changes

The PR makes OpenClaw’s POSIX, CLI, and PowerShell Git installers reject an existing checkout whose HEAD cannot resolve to a commit, preserving the directory and adding focused coverage.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for installer-owner review, not cleanup: current main still accepts an existing .git directory without first proving that HEAD resolves to a commit, while the branch adds that boundary check in all three official Git installers. The patch and supplied real-Git transcript support the repair, but merging intentionally changes recovery for a damaged existing destination: it stops early and asks the operator to move or remove it before retrying.

Likely related people: Peter Steinberger is the only current-main history signal found for these installer entry points, with low confidence because the available blame trail is carried by a broad recent commit rather than a focused installer change.

Priority: P2
Reviewed head: 3b2147f2dfc35c34b600246ab31fe2093a4cb67f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent installer repair with strong supplied behavior proof; the remaining gate is an intentional compatibility decision rather than a demonstrated patch defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides after-fix terminal evidence from real Git repositories, including a nested damaged checkout and valid controls across all three installer surfaces; no private data is exposed in the supplied transcript.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-fix terminal evidence from real Git repositories, including a nested damaged checkout and valid controls across all three installer surfaces; no private data is exposed in the supplied transcript.
Evidence reviewed 7 items Current-main bug path: Current POSIX installation logic treats the presence of $repo_dir/.git as the reusable-checkout signal, then runs status, checkout, dependency installation, and build work without a commit-object validation gate.
All installer owners are patched: The branch introduces a pinned --git-dir and --work-tree rev-parse --verify --quiet HEAD^{commit} check in the POSIX installer, the CLI installer, and PowerShell before their existing-update paths continue.
Regression coverage follows the boundary: The branch adds a real damaged Git-repository fixture for the POSIX guard, a CLI installer call-path test, and PowerShell assertions for the exact pinned command and non-destructive behavior.
Findings None None.
Security None None.

How this fits together

The Git install scripts either clone OpenClaw into a destination or reuse that destination before fetching, checking out, installing dependencies, and building. This change adds an early repository-validity gate so an incomplete clone receives an actionable recovery outcome rather than failing later in update or build work.

flowchart LR
  A[Git install destination] --> B[Official installer]
  B --> C{Existing .git directory?}
  C -->|No| D[Clone OpenClaw]
  C -->|Yes| E{HEAD resolves to commit?}
  E -->|Yes| F[Update checkout and build]
  E -->|No| G[Preserve directory and show recovery guidance]
  D --> F
Loading

Decision needed

Question Recommendation
Should existing Git-install destinations with a .git directory but no resolvable HEAD now fail immediately with manual recovery guidance rather than proceeding into the current later update/build path? Accept early recovery failure: Merge the branch so damaged existing checkouts stop before update and build work while preserving potentially recoverable files.

Why: The patch is a targeted repair, but it intentionally changes upgrade/retry behavior for a pre-existing damaged local installation and makes operator recovery explicit.

Before merge

  • Resolve merge risk (P1) - Merging deliberately changes retry behavior for an already-created but commit-less Git destination: instead of reaching later Git, dependency, or build failures, it stops and requires the operator to preserve, move, or remove that directory before retrying.
  • Complete next step (P2) - No mechanical repair remains: an installer owner should decide whether the deliberate early-stop recovery behavior is acceptable for existing damaged destinations.
Agent review details

Security

None.

PR surface

Tests +82, Other +40. Total +122 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 82 0 +82
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 40 0 +40
Total 6 122 0 +122

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #113808
Summary: This PR directly targets the canonical report’s commit-less-checkout installer behavior and is the active candidate fix, not a duplicate cleanup item.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept the explicit recovery boundary (recommended)
    Merge after confirming that operators with damaged existing Git destinations should receive an early stop and manual recovery guidance.
  2. Pause for installer policy
    Keep the PR open if maintainers want a different supported recovery flow for incomplete existing checkouts.

Technical review

Best possible solution:

Confirm that early, non-destructive failure is the intended installer recovery contract, then merge the pinned commit-object validation across the three owner scripts and retain the focused regression coverage.

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

Yes, source reproducibly establishes the path: current main accepts .git as sufficient and then continues into status, checkout, dependency, and build operations. The PR context additionally supplies a real-Git damaged-checkout transcript covering the intended before/after boundary.

Is this the best way to solve the issue?

Yes, this is the best repair shape: each official installer owns its own lifecycle, and a pinned HEAD^{commit} verification prevents Git from discovering a parent repository while preserving the damaged directory for recovery.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The defect blocks a bounded Git-install retry path and produces misleading later failures, without affecting the core runtime.
  • merge-risk: 🚨 compatibility: Existing incomplete Git destinations that previously advanced into later installer steps will instead stop early and require explicit operator recovery.
  • 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 PR body provides after-fix terminal evidence from real Git repositories, including a nested damaged checkout and valid controls across all three installer surfaces; no private data is exposed in the supplied transcript.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix terminal evidence from real Git repositories, including a nested damaged checkout and valid controls across all three installer surfaces; no private data is exposed in the supplied transcript.

Evidence

What I checked:

  • Current-main bug path: Current POSIX installation logic treats the presence of $repo_dir/.git as the reusable-checkout signal, then runs status, checkout, dependency installation, and build work without a commit-object validation gate. (scripts/install.sh:2863, a1b41d5ddb05)
  • All installer owners are patched: The branch introduces a pinned --git-dir and --work-tree rev-parse --verify --quiet HEAD^{commit} check in the POSIX installer, the CLI installer, and PowerShell before their existing-update paths continue. (scripts/install.sh:2421, 3b2147f2dfc3)
  • Regression coverage follows the boundary: The branch adds a real damaged Git-repository fixture for the POSIX guard, a CLI installer call-path test, and PowerShell assertions for the exact pinned command and non-destructive behavior. (test/scripts/install-sh.test.ts:347, 3b2147f2dfc3)
  • Canonical hosted installer source: The website sync workflow copies these three repository installer sources into the hosted installer assets after main-branch verification, so changing the source scripts rather than the generated website copies matches the delivery owner boundary. (.github/workflows/website-installer-sync.yml:125, a1b41d5ddb05)
  • Current-main and branch provenance: The candidate commit is not an ancestor of current main, so the central behavior is not already implemented on main; the branch head is a focused final commit on the PR’s stated base. (scripts/install.sh:2863, 3b2147f2dfc3)
  • Current-area history signal: Available blame attributes the current installer entry points to Peter Steinberger’s recent carrying commit; this is a routing signal only, not evidence that the commit introduced this defect. (scripts/install.ps1:1462, d92d68ac7766)

Likely related people:

  • Peter Steinberger: Current blame for the three installer entry points resolves to a recent commit authored by Peter Steinberger; the commit is broad, so this is only a low-confidence routing signal. (role: recent current-main source carrier; confidence: low; commits: d92d68ac7766; files: scripts/install.sh, scripts/install-cli.sh, scripts/install.ps1)

Rank-up moves

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

  • Obtain installer-owner confirmation that early manual recovery is the desired behavior for existing damaged Git destinations.

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 (6 earlier review cycles)
  • reviewed 2026-07-25T19:08:20.478Z sha 41eea9de70671f4fe6712d017aee036bb7b40347 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-29T12:53:06.682Z sha 41eea9de70671f4fe6712d017aee036bb7b40347 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-29T14:48:18.963Z sha 3b2147f :: needs real behavior proof before merge. :: [P1] Patch the hosted installer sources
  • reviewed 2026-07-29T14:54:17.878Z sha 3b2147f :: needs real behavior proof before merge. :: [P1] Patch the hosted installer sources
  • reviewed 2026-07-29T15:12:05.157Z sha 3b2147f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-29T15:18:01.284Z sha 3b2147f :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 29, 2026
@ooiuuii

ooiuuii commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 29, 2026
@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 29, 2026
@ooiuuii
ooiuuii force-pushed the fix/install-recover-incomplete-git-checkout branch from 41eea9d to 8955621 Compare July 29, 2026 14:40
@ooiuuii
ooiuuii force-pushed the fix/install-recover-incomplete-git-checkout branch from 8955621 to 3b2147f Compare July 29, 2026 14:42
@ooiuuii

ooiuuii commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 29, 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 repository_dispatch).
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 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. labels Jul 29, 2026
@clawsweeper clawsweeper Bot added the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Jul 29, 2026
@ooiuuii

ooiuuii commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The hosted-installer source finding is addressed in the PR evidence. .github/workflows/website-installer-sync.yml makes this repository's three scripts/install* files the canonical sources: after the static, Linux Docker, macOS, and Windows jobs pass, a push to main copies them verbatim to openclaw.ai/public/*, validates/builds the website, and pushes openclaw.ai/main (lines 125-210). The current Website Installer Sync run is green for all four PR verification jobs; sync-website is intentionally skipped for pull requests and runs after merge on the main push. A separate website-repository patch would duplicate generated output rather than fix the owner boundary.

@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 29, 2026
@steipete
steipete merged commit 8075063 into openclaw:main Aug 2, 2026
132 of 148 checks passed
vincentkoc added a commit that referenced this pull request Aug 2, 2026
* origin/main:
  fix(install): reject commit-less git checkouts (#113809)
  chore(i18n): refresh native locales (#117948)
  fix(release): validate MiniMax M3 in stable lanes (#118017)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* fix(install): reject commit-less git checkouts

* test(install): fix incomplete-checkout coverage

* fix(install): pin incomplete checkout validation

* test(install): update pinned checkout stub

* fix(install): require checkout HEAD commit object
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  fix(install): reject commit-less git checkouts (openclaw#113809)
  chore(i18n): refresh native locales (openclaw#117948)
  fix(release): validate MiniMax M3 in stable lanes (openclaw#118017)
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.

[Bug]: Git installers continue from commit-less checkouts

2 participants