Repository navigation
fix(tooling): preserve Git hook choices during install - #139461
Conversation
Read the effective hooks path before initializing an unset selection in worktree scope. Preserve inherited and empty settings; let Git refuse shared initialization instead of changing sibling checkout configuration. Fixes #139449. Seven real-Git regression cases fail before the repair; the final 15-case suite and scoped checks pass. Tooling net -15 LOC.
|
🦞👀 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. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 6:29 PM ET / 22:29 UTC. ClawSweeper reviewWhat this changesPreserve existing Git hook selections during dependency installation, initialize unset selections in worktree scope, and document and test the resulting behavior. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused repair: current main and the latest release still overwrite hook selections. No introduced correctness defect was found, and the related publication-preflight proposal addresses different behavior. Priority: P2 Review scores
Verification
How this fits togetherSource installations invoke a preparation script that configures Git’s local commit hook. That script connects package installation to Git configuration, which determines which hook later runs during commits. flowchart TD
A[Dependency installation] --> B[Hook preparation]
B --> C{Source checkout available?}
C -->|No| D[Skip setup]
C -->|Yes| E{Hook selection exists?}
E -->|Yes| F[Preserve selection]
E -->|No| G[Ask Git for worktree write]
G --> H[Configure hook or warn without fallback]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +189, Docs +7, Other -15. Total +181 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Git responsible for configuration scope, preserve existing selections, and retain the documented warning when safe initialization requires owner-enabled worktree configuration. Do we have a high-confidence way to reproduce the issue? Yes: current main’s unconditional Git configuration write establishes the mechanism, and the linked report supplies real-Git before/after observations. This review did not execute the reproduction. Is this the best way to solve the issue? Yes: the patch repairs the existing preparation owner using Git’s native lookup and scope rules, without introducing a competing configuration mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 40ebdadcafa6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (95 commits) perf(build): avoid unrelated gateway artifact scans (#127757) fix(update): deliver terminal progress after long updates (#139289) fix(ui): show session hover cards for local chat URLs (#139384) perf(ui): reuse unchanged transcript key snapshots (#139400) fix(ui): make subagent sessions view-only (#139381) fix: open agent state on SQLite builds without extensions (#139487) perf(skills): detach cached metadata from source strings (#139478) fix(ui): show primary user in multi-agent profile hero (#136736) perf(sessions): stop decoding the session row four times per SQLite entry patch (#136361) refactor(exec): share package-manager option scans (#139482) fix(ci): authorize frozen mobile release candidates (#139441) fix: avoid session deletion slowdown in large session stores (#139467) perf(gateway): reuse node invocation idle timers (#139354) fix(auth): preserve selected profiles across plugin scopes (#139413) fix(discord): retain voice input until transcription completes (#139484) fix(agents): name Gateway storage failures in run-failure copy (#139409) fix: keep subagent checks responsive in large session stores (#139450) fix(memory): index notes when optional embeddings cannot start (#139463) fix: refresh pending approvals when reopening chat (#139457) fix(tooling): preserve Git hook choices during install (#139461) ...
Read the effective hooks path before initializing an unset selection in worktree scope. Preserve inherited and empty settings; let Git refuse shared initialization instead of changing sibling checkout configuration. Fixes openclaw#139449. Seven real-Git regression cases fail before the repair; the final 15-case suite and scoped checks pass. Tooling net -15 LOC.
Closes #139449.
What Problem This Solves
Fixes an issue where contributors running dependency installation would have an existing Git hook choice replaced, or a linked checkout would change shared hook settings for its siblings. Private worktree overrides could hide that shared change even while setup reported success.
Why This Change Was Made
Prepare now reads Git's effective
core.hooksPathand preserves an existing selection, including inherited and explicitly empty values. Only Git's missing-key result permits initialization, using--worktreeso Git owns scope selection. Configuration errors keep the existing nonfatal warning; setup does not retry with a shared write or enable the worktree-config extension.The command closure replaces two passthrough helpers. Tooling +19/−34 (net −15), tests +207/−18 (net +189), docs +9/−2 (net +7). The existing package lifecycle entrypoint and hook implementation remain unchanged.
User Impact
Installation respects configured hook choices and avoids changing sibling-checkout settings. A fresh single checkout still gets the repository hook. An unconfigured repository with multiple worktrees needs owner-enabled
extensions.worktreeConfigfor automatic setup; otherwise Git warns and installation continues with hook settings unchanged. The contributor guide explains this existing Git configuration mechanism.Maintainer disposition of ClawSweeper's P1 merge risk: retain the documented safe skip, its recommended option. This deliberately affects only automatic initialization when no hook path is configured and Git cannot provide private worktree scope. Existing configured paths and fresh single checkouts retain their supported behavior. Falling back to a shared write would recreate the reported sibling mutation; automatically enabling the extension would make a broader Git configuration change. The warning and linked owner-controlled setup instructions make the non-initialization visible and actionable. This disposition resolves the requested decision without a code change.
Evidence
The unscoped write dates to 6b83d82 and was preserved by the cross-platform extraction in d21abb8; current main and stable
v2026.9.2contain the same helper. Draft #114287 overlaps these files for a separate optional publication feature and retains the unscoped write. This PR does not incorporate that proposal. Exact-head CI passed 78 jobs (16 skipped). ClawSweeper's completed review found no correctness or security issue and requested the maintainer decision recorded above.