Repository navigation
fix(install): support linked Git worktree checkouts - #172934
Conversation
Recognize native gitfiles while preserving explicit checkout-local HEAD validation. Share the Bash guard and reject nonempty destinations without local Git metadata in the sibling shell and PowerShell installers. Exercise real linked worktrees, broken/missing HEAD metadata, and ancestor-only destinations across Bash and native PowerShell, retaining metadata and the other worktree HEAD. Keep release-note context in the PR.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2509de3794
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThe installers recognize Git metadata files, share Bash checkout validation, and reject nonempty destinations without checkout-local metadata. Example: Install a commit-pinned checkout at /tmp/linked checkout whose .git is a linked-worktree metadata file.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: the checkout validation repair is useful, but branch-selected linked-worktree installs still fail when another worktree holds main. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe shell and PowerShell installers turn an operator-selected checkout into a built CLI and executable wrapper after validating metadata and selecting source revisions. flowchart TD
A[Installer arguments] --> B[Checkout admission]
B --> C[Git revision selection]
C --> D[Dependency installation]
D --> E[Source build]
E --> F[CLI wrapper]
Technical reviewBest possible solution: Complete linked-worktree handling in the existing shared revision selector while preserving other worktrees and providing actionable destination errors. Do we have a high-confidence way to reproduce the issue? Source establishes both the current-main gitfile rejection and the remaining main-branch ownership failure; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Sharing explicit checkout-local validation is appropriate, but admitting gitfiles alone does not complete installation for branch selectors. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9d5724ca7240. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests +171, Docs +4, Other 0. Total +175 across 11 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 4:30 AM ET / 08:30 UTC. |
Select occupied branches detached without changing the primary worktree. Keep local-main behavior when Git updates are disabled, share destination validation, and explain recovery from non-checkout destinations.
|
Merged via squash.
|
* fix(install): support linked Git worktree checkouts Recognize native gitfiles while preserving explicit checkout-local HEAD validation. Share the Bash guard and reject nonempty destinations without local Git metadata in the sibling shell and PowerShell installers. Exercise real linked worktrees, broken/missing HEAD metadata, and ancestor-only destinations across Bash and native PowerShell, retaining metadata and the other worktree HEAD. Keep release-note context in the PR. * fix(install): preserve branches owned by other worktrees Select occupied branches detached without changing the primary worktree. Keep local-main behavior when Git updates are disabled, share destination validation, and explain recovery from non-checkout destinations.
What Problem This Solves
Fixes Git installs that reject an existing linked worktree because its
.gitmetadata is a file. Sibling installers also skipped commit validation for this layout and could treat a nonempty directory inside another checkout as the install root.User Impact
All three installers validate the selected checkout’s own commit before installing checkout package dependencies. Invalid destinations receive guidance to choose the checkout root or a new empty directory, while existing files remain untouched.
The shell installers can select a branch already held by another worktree without moving that worktree’s branch or index. The selected checkout becomes detached but remains a moving-branch install.
mainstarts at the local branch and rebases only when updates are enabled; other branch selectors use the fetched origin branch.Why This Change Was Made
Git supports both
.gitdirectories and gitfiles. Share explicit checkout-local metadata and HEAD validation in the existing Bash installer policy, apply equivalent PowerShell admission checks, and use Git’sworktreepathfact to detect occupied branches. Ordinary branch selection, pinned commits, tag precedence, and rebase recovery retain their existing behavior. Production changes remain net neutral; no new flags or configuration are introduced.Evidence
Real Git fixtures reproduce the original linked-worktree refusal and sibling invalid-HEAD / ancestor-directory gaps. The repaired Bash paths publish runnable wrappers from synthetic builds; both generated standalone installers were also exercised. Negative controls with an impossible expected CLI version fail as intended.
The reserved-branch regression first failed all eight new cases across both shell installers. The repaired focused Vitest run passes 27 tests: valid and invalid metadata boundaries, reserved main, updates-disabled main, latest fallback, another occupied branch, and existing ordinary selector / rebase recovery cases. Primary worktree ref, HEAD, index, and linked metadata remain unchanged. Fixtures set temporary HOME, prefix, and TMP paths plus source guards and deny sentinels before loading installers.
Native Windows PowerShell 5.1 and PowerShell 7.6.7 also exercised 16 baseline-versus-patched admission comparisons for valid linked metadata, missing HEAD, broken gitfiles, and non-checkout subdirectories, stopping before dependency installation or builds. A hidden-gitfile fixture setup error was corrected and those four cases rerun; the subsequent PowerShell source change adds recovery guidance only.
Shell syntax, ShellCheck at error severity, TypeScript parsing, and formatting pass. Scoped Oxlint cannot start because the available tooling lacks
eslint-plugin-solid; CI supplies lint and broad integration proof. The focused Vitest run took 109 seconds; full test-file timing is unavailable because unrelated tests were excluded.Independent Codex review of the initial repair and fresh follow-up review of the complete installer owners, regression fixture, and docs are clean through P2.