Repository navigation
fix(run): skills preflight validates each worktree, not the main checkout (#933) - #1001
Merged
admarble merged 7 commits intoSep 8, 2026
Conversation
…kout (#933) git worktree add only materializes tracked files, so an untracked .claude/skills/ (the default post-sequant-sync state) passed the pre-flight while every worktree phase agents actually run in had none. Move the check to run once per provisioned worktree after worktree creation, skip it entirely for drivers that don't resolve skills, and name the worktree path plus the commit .claude/skills remedy in the failure message. Entire-Checkpoint: a1ae82124e30
4 tasks
…ed; name the manual step for reused ones (#933)
…ing when isolation is off; removal result checked (#933)
… failed-removal remedy uses git worktree remove --force
…emoval remedy adds prune; test the unknown-driver fallback (#933)
…isting worktrees (#933)
…kills-preflight-validates-the-main-checko # Conflicts: # CHANGELOG.md
admarble
deleted the
feature/933-fix-run-skills-preflight-validates-the-main-checko
branch
September 8, 2026 01:34
This was referenced Sep 8, 2026
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
sequant run's skills pre-flight now runs once per provisioned worktree (after worktree creation), not once against the main checkout.git worktree addonly materializes tracked files, so an untracked.claude/skills/(the default post-sequant syncstate) previously passed the pre-flight while every worktree phase agents actually run in had none.driverResolvesSkillsexport so non-skill drivers (aider) make zero pre-flight calls, matching AC-3.Pre-PR AC Verification
skills-preflight.test.ts"933 AC-1" — mutation-verified belowcwd= each worktree pathskills-preflight.test.ts"933 AC-2" — asserts observed cwd equals worktree path, not main checkout--dry-runand non-skill drivers (aider) make zero pre-flight callsskills-preflight.test.ts"933 AC-3" (both dry-run and aider cases)grep -c 'runSkillsPreflight(' src/lib/workflow/run-orchestrator.ts→1; call at line 1169 >Cleanup worktree forat line 1123Mutation-verified: AC-1 — reverted
cwdsToCheckto[process.cwd()]instead of the per-worktree paths (the pre-#933 bug); src/lib/workflow/skills-preflight.test.ts ("933 AC-1: untracked .claude/skills fails fast …") failed —runIssuewas called, meaning the untracked skill in the main checkout let the run past pre-flight; restored.Marker
failedTestcorrected by the runner on 2026-09-07 to name the test file in the diff (the parser rejects test titles astest_not_in_diff); the mutation itself was performed by the exec agent as described.Test plan
npm run build— passesnpm run lint— passesnpx vitest run src/lib/workflow/skills-preflight.test.ts -t "933"— 4/4 passnpx vitest run src/lib/workflow/skills-preflight.integration.test.ts— 2/2 pass (updated for the new post-provisioning call order)npm testsuite — ran green in CI (build (22.x)) on this commit (background test runs were repeatedly torn down by environment session churn before finishing); targeted and integration coverage for the changed area is greenCloses #933
A+ pass (runner, 2026-09-07, commit d4f1a07)
Addresses the QA round-3 adversarial finding (orphaned worktree on the abort path) so this PR can reach READY_FOR_MERGE. PLAN §9 OQ-17 asked whether this belongs to node 05 or node 09; the runner took node 05 because the abort site is the preflight call this PR moved, and the change adds a block at that site only — the cleanup-registration block (node 09's) is untouched.
git worktree remove --force) and their registered cleanups unregistered beforedispose()(which clears cleanups without running them). A re-run then re-provisions from the new commit, so the printed remedy actually recovers.git worktree remove <path>, or--forceto re-provision.skills-preflight.test.tsAC-1 (realgit worktree add) now asserts the created worktree is gone from disk and fromgit worktree list --porcelainafter the abort, and that the remedy says so — the lifecycle assertion the original diff had deleted, restored at the layer that can observe it (the integration test mocksensureWorktrees).22/22 preflight unit + integration tests pass; typecheck clean.
A+ round 4 (runner, 2026-09-07, commit 2c06730)
Addresses the QA round-4 findings on the abort remedy text:
--forceadvice.run --forcebypasses the state guard and takes over locks; it never re-provisions a worktree, so the reused-worktree branch now says only: "The pre-existing worktree was kept: remove it first (git worktree remove <path>) so the re-run provisions it from the new commit."git worktree removestatus is read; a failed removal produces its own remedy ("could not be removed … remove it before re-running") instead of an untrue "was removed".ensureWorktreesmock reports a worktree the test pre-created asexisted: true(mirroring the real one), and two new cases drive the reused-worktree remedy and theworktreeIsolation: falseremedy through the realRunOrchestrator.run().A+ round 5 (runner, 2026-09-07, commit 219b743)
realpathSync(worktreeFixture.repo)(process.cwd() is canonical,/private/varon macOS; the fixture path was not, so the old assertion could never fail). Mutation-verified below.input.cwd ?? "<no-cwd>"), so a reintroduced cwd-less pre-provisioning call would be counted.git worktree remove --force <path>(the automated attempt was already--force). The "never offer--force" rule is aboutsequant run --force, which does not re-provision; the tests now assert exactly that (not.toMatch(/re-run with --force/)).npm ci) now precedes the abort — a cheap pre-provisioning "is.claude/skillstracked?" check could restore fail-fast without reverting AC-4's post-provisioning requirement (follow-up, coordinate with fix(run): abort-path paper cuts — "work is preserved in <worktree>" is false under SIGTERM, andabort's doc comment cites the wrong issue #935 which owns the cleanup block); the failed-removal branch anddriverResolvesSkills's unknown-driver fallback have no direct tests.Mutation-verified: AC-2 — added
process.cwd()tocwdsToCheckalongside the worktree paths;src/lib/workflow/skills-preflight.test.ts(933 AC-2) failed; restored (reversible edit,prettier --checkclean).A+ round 6 (runner, 2026-09-07, commit 9781451)
git ls-files --error-unmatchcheck that is not a secondrunSkillsPreflightcall), to land as a follow-up coordinated with fix(run): abort-path paper cuts — "work is preserved in <worktree>" is false under SIGTERM, andabort's doc comment cites the wrong issue #935.Also removed (created for this run): …) and any left in place; a two-issue abort test asserts both worktrees are gone from disk and fromgit worktree listand both appear in the reason.git worktree remove --force <path>followed bygit worktree prune, rather than repeating the exact command that just failed.driverResolvesSkillsfallback tested (aider → false, claude-code → true, undefined → true, unknown driver → true via the catch, so the guard runs rather than skips).git worktree remove --forceto fail in a test).A+ round 7 (runner, 2026-09-07, commit 517babe)
git worktree remove --force <path>, thengit worktree prunestep), and left in place (pre-existing) — so a worktree whose forced removal failed is never labelled as intentionally kept. Same rule the round-4 fix applied to the failing cwd.git worktree remove --forceto fail).prompt-wait,batch-executor > withActivityHook,relay-hook.integration) fail identically onorigin/mainand pass in CI — environment-dependent, unrelated to this PR.