Skip to content

I2718 — A linked worktree runs its own hooks, never the primary checkout's

Make every linked worktree run, and doctor judge, the hooks of its own tree, so that a stale primary checkout cannot refuse or weaken the commits of every other worktree.

DONE wave 0 · p0 · implementation profile · parallel safe

Part of development-runtime — The runtime has a development surface.

Objective

Make every linked worktree run, and doctor judge, the hooks of its own tree, so that a stale primary checkout cannot refuse or weaken the commits of every other worktree.

Why

2026-10-14 ~19:25Z: commits on branches based on current master were refused in every worktree with \"FAIL wiring ssh-permissions-on-commit — providers-check --permissions-only is not invoked by <primary checkout>/.githooks/pre-commit\". core.hooksPath is the relative `.githooks`, and git 2.55 resolves it against the MAIN worktree (`git -C <linked worktree> rev-parse --git-path hooks` answered the primary's path), so all 329 linked worktrees ran the primary checkout's hooks, and the primary sat at afbc25924a (2026-10-11). Fixed by hand at 19:3xZ with the owner's approval: the primary's .githooks restored from origin/master, extensions.worktreeConfig enabled (repositoryformatversion 1), and each linked worktree given core.hooksPath = its own absolute .githooks in its config.worktree. A worktree created after that falls back to the primary again.

Current state

The per-worktree setting exists only where it was set by hand; `majordomus worktree create` does not set it; doctor's wiring check reads whatever `git rev-parse --git-path hooks` answers without saying which tree's hooks those are.

Desired state

`majordomus worktree create` (and `worktree migrate`/repair) sets the worktree's own core.hooksPath, enabling extensions.worktreeConfig when it is off; doctor fails, with the command that fixes it, when a linked worktree's hooks resolve outside its own tree; the main worktree keeps `.githooks`.

Scope

  • apps/majordomus-cli/src/worktree
  • apps/majordomus-cli/src/commands/worktree.rs
  • lib/doctor.sh
  • docs/WORKTREES.md
  • test/cases

Dependencies

None. This issue is a root of the graph.

Acceptance criteria

  • A worktree made by `majordomus worktree create` answers its own .githooks to `git rev-parse --git-path hooks`
  • doctor in a linked worktree whose hooks resolve to another tree fails with the fixing command
  • The main worktree's hooks path is unchanged

Validation

  • bin/majordomus plan validate

Evidence required

  • worktree_runs_its_own_hooks_case

Evidence

coverstypecommandresultat commit
worktree_runs_its_own_hooks_casetestMJ_TEST_JOBS=4 bash test/run.sh 3036_a_worktree_runs_its_own_hooksok 3036_a_worktree_runs_its_own_hooks 100s (0 skipped) at 09c334079f5 with the executable of #1304: worktree create binds its own .githooks (relative and absolute hooksPath), a commit there runs the worktree's own pre-commit, doctor fails wiring hooks-path in a hand-made worktree, the primary's hooks path unchanged; delivered in the grand top 11e53f5a451 and 51faa7a5c7609c3340

Timeline

started
2026-10-16T16:39:12Z
verified
2026-10-16T16:39:17Z
completed
2026-10-16T16:39:25Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I2718.yaml. Read it back with majordomus plan show I2718.

Searches the titles and descriptions of every page this site publishes.