Repository navigation
fix(#1469): a failed git worktree add must fail the issue, not run its phases in the main checkout (two CLIs race on .git/config) - #1493
Merged
admarble merged 6 commits intoOct 17, 2026
Conversation
Entire-Checkpoint: 3fcd41291415
…rent runs Entire-Checkpoint: 8168ae365a85
Entire-Checkpoint: 4f88caa4562c
…a-failed-git-worktree-add-must-fail-the-is
…the [branch] header; ADR-0017 records the worktreeRequired contract QA: the '[branch "…"]' section is also written by recordWorktreeBaseRef, so the old assertion passed with no upstream; after a lost lock the retry adds the branch without -b and the upstream is set later by push -u. Assert branch.<name>.sequantBaseRef, the thing provisioning guarantees. ADR-0017 (spec Design Review) with options B–E rejected. Entire-Checkpoint: 502d4326c9eb
4 tasks
…dd-must-fail-the-is
This was referenced Oct 17, 2026
admarble
deleted the
feature/1469-fix-run-a-failed-git-worktree-add-must-fail-the-is
branch
October 18, 2026 23:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1469
Under worktree isolation, an issue whose
git worktree addfailed used to drop out of the worktree map and run spec, exec and QA in the main checkout (the executor'sprocess.cwd()fallback), on whatever branch was checked out there. Seen 2026-10-15 when twosequant runCLIs raced on.git/config.lock; reproduced 11/40.IssueExecutionContextcarriesworktreeRequiredandworktreeError;BatchExecutionContext/OrchestratorConfigcarryworktreeRequiredand aworktreeFailuresmap that provisioning fills with git's stderr. Both producers (executeOneIssue,executeBatch) set them; the one consumer,runIssueWithLogging, fails the issue before state init and before any phase (abortReason: worktree provisioning failed: …, emptyphaseResults). The executor's fallback is unchanged:undefinedthere is also the legitimate isolation-off and spec-phase case (ADR-0017, option B rejected).git-config-lock.ts:retryOnConfigLock(5 attempts, 100→800 ms, injectable sleep) wrapsworktree addandrecordWorktreeBaseRef. A retry re-checks whether the failed-battempt already created the branch and adds it as existing;git worktree pruneruns before each retry.recordWorktreeBaseRefreturns{ ok } | { ok: false, error }instead of swallowing; both callers warn that the default base is in effect.N created, M reused, K failed; chain mode fails every successor of a broken link withchain broken: #<pred> has no worktree.Acceptance criteria
npx vitest run src/lib/workflow/run-orchestrator.worktree-failure.test.ts→ 3 passed, 0 failednpx vitest run src/lib/workflow/worktree-manager.integration.test.ts -t "config.lock"→ 2 passed, 0 failednpx vitest run src/lib/workflow/phase-executor.test.ts -t "recordWorktreeBaseRef"→ 3 passed, 0 failednpx vitest run src/lib/workflow/worktree-manager.integration.test.ts -t "concurrent"→ 1 passed, 0 failed (twonpx tsxchild processes released by a barrier file)Mutation-verified: AC-1 — replaced the
worktreeRequired && !worktreeguard inrunIssueWithLoggingwith a never-true condition;src/lib/workflow/run-orchestrator.worktree-failure.test.ts > worktree provisioning > a missing worktree fails the issue before any phasefailed (the other two cases in the file skipped by-t); restored, 3 passed.QA findings and their resolution
QA verdict AC_MET_BUT_NOT_A_PLUS, 4/4. The three findings:
[branch "…"]header and called it "kept the upstream" → the header is also written byrecordWorktreeBaseRef, and after a lost lock the retry adds the branch without-b, so no upstream is guaranteed (the PR push sets it withpush -u). The test now assertsbranch.<name>.sequantBaseRef=origin/main, the thing provisioning guarantees, and the comment says why. Fixed in this PR.docs/adr/0017-worktree-required-contract.mdplus its index row. Fixed in this PR.Checks
plugin/,.claude/skills/ortemplates/skills/(plugin freeze).npx tsc --noEmitclean in the worktree; full integration file 3 passed.CHANGELOG.md[Unreleased]entry inmain's current convention (fragments arrive with feat(#1351): improve(release): changelog fragments instead of a shared [Unreleased] block — 121/192 main commits touch CHANGELOG.md #1370).🤖 Generated by
sequant run; verified and amended by the runner session.