You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decide whether Worktree ownership inspection may recheck the launch repository less often #858
The Spec review of #857 (for #846, "shorten macos CI time") found that the largest remaining spawn cost in Worktree ownership inspection is the launch-side git rev-parse --git-common-dir. #857 left it untouched.
Evidence
The Spec reviewer straced spec_run a_ticket_needs_only_a_trusted_author_not_a_ready_label_of_its_own on #857's branch:
4,202 programs ran in total. 1,544 of them (~37%) were rev-parse --git-common-dir.
Those calls come mostly from Directory::verify_repository (src/worktree/ownership.rs). It runs before the ownership lock, around each inspection's start and end, and via Git::lock to find the lock path.
One ordinary Worktree::head() runs 23 git processes; 11 of them are --git-common-dir.
Spawning git dominates the macOS shards' 16–20 minute test time.
Why this is not the implementer's call
Each call re-establishes that the Launch directory still belongs to the captured common repository, before and after Git observations. This is the pinned-ownership model ADR 0014 relies on. Caching the result, or dropping a recheck, would narrow what inspection checks. That is a security design decision for the Day shift, not part of an untriaged CI-time ticket. #857 kept every check.
#894 attributed the macOS shards' remaining test time. In short, they are git processes, and most of those come from the checks this issue holds. Method, runs and per-test numbers are in docs/ci-performance.md, "After #857: the macOS breakdown", on the #894 branch.
26 slowest tests (the 16 over 60 s in main run 39430050727, plus ten more), run alone on macos-26 under dtrace: git processes were alive for 77–99% of each test's wall time, 88% summed. The fake gh/claude/codex took 1–3%. fsync took under 0.1 s. thirdshift's sleeps overlapped with git work.
By caller (Linux strace of the same tests; git counts agree with macOS within 1% in total):
41%rev-parse --git-common-dir: the launch-side recheck, mostly Directory::verify_repository
43% the rest of Worktree ownership inspection: worktree list --porcelain -z, the combined rev-parse --show-toplevel …, rev-parse --symbolic-full-name HEAD, the branch for-each-ref
17% everything else
Per process on the runner (median of 200): Homebrew git rev-parse --git-common-dir 13.2 ms, Xcode's git 9.1 ms, against 2.4 ms on x86_64 Linux.
Example:spec_run security_findings_refusals_and_incomplete_reviews_hold_only_the_spec_self_merge took 260 s alone, with 15,606 git processes alive for 213 s. 6,348 of its Linux git processes were the launch recheck, and 6,872 were ownership inspection.
#894 makes no change to either check. It cut the per-process cost instead, with Xcode's git and Spotlight off in macOS CI. Xcode's git alone took the four shards' summed test time from a 3,441 s mean to 2,132 s. Even so, 83% of the git processes in the slowest tests are still these checks. The remaining macOS test time scales with how often inspection rechecks the launch repository, which is this issue's decision.
The cost is measured (#894): rev-parse --git-common-dir from repository verification is about 41% of git spawns. Narrowing those rechecks weakens the pinned-ownership model ADR 0014 relies on, which is a security decision. #939 (drop macOS) is the alternative way to cut the cost.
Next step: decide whether one verification may be cached within an inspection or lock scope, and with what invalidation. If yes, it is one agent Ticket plus an ADR note.
Activity
JacobStephens2 commentedon Oct 21, 2026
This was generated by AI while implementing #894.
macOS numbers for this decision
#894 attributed the macOS shards' remaining test time. In short, they are git processes, and most of those come from the checks this issue holds. Method, runs and per-test numbers are in
docs/ci-performance.md, "After #857: the macOS breakdown", on the #894 branch.macos-26under dtrace: git processes were alive for 77–99% of each test's wall time, 88% summed. The fakegh/claude/codextook 1–3%. fsync took under 0.1 s. thirdshift's sleeps overlapped with git work.rev-parse --git-common-dir: the launch-side recheck, mostlyDirectory::verify_repositoryworktree list --porcelain -z, the combinedrev-parse --show-toplevel …,rev-parse --symbolic-full-name HEAD, the branchfor-each-refgit rev-parse --git-common-dir13.2 ms, Xcode's git 9.1 ms, against 2.4 ms on x86_64 Linux.spec_run security_findings_refusals_and_incomplete_reviews_hold_only_the_spec_self_mergetook 260 s alone, with 15,606 git processes alive for 213 s. 6,348 of its Linux git processes were the launch recheck, and 6,872 were ownership inspection.#894 makes no change to either check. It cut the per-process cost instead, with Xcode's git and Spotlight off in macOS CI. Xcode's git alone took the four shards' summed test time from a 3,441 s mean to 2,132 s. Even so, 83% of the git processes in the slowest tests are still these checks. The remaining macOS test time scales with how often inspection rechecks the launch repository, which is this issue's decision.
JacobStephens2 commentedon Oct 25, 2026
Triage: ready for a human
The cost is measured (#894):
rev-parse --git-common-dirfrom repository verification is about 41% of git spawns. Narrowing those rechecks weakens the pinned-ownership model ADR 0014 relies on, which is a security decision. #939 (drop macOS) is the alternative way to cut the cost.Next step: decide whether one verification may be cached within an inspection or lock scope, and with what invalidation. If yes, it is one agent Ticket plus an ADR note.