Repository navigation
refactor(#1475): worktreeStatus tri-state replaces both isWorktreeDirty copies; one formatSignalLine - #1563
Merged
admarble merged 4 commits intoOct 20, 2026
Conversation
Entire-Checkpoint: 86af4921822c
Entire-Checkpoint: 9a039f45882a
5 tasks
…-workflow-locks-worktreestatus-tri-state-r
Entire-Checkpoint: 133846439c21
admarble
deleted the
feature/1475-refactor-workflow-locks-worktreestatus-tri-state-r
branch
October 20, 2026 02:53
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
worktreeStatus(path)(src/lib/workflow/worktree-manager.ts) returns"clean","dirty"or"unknown". It is now the only place insrc/lib/workflowthat runsgit status --porcelainto decide whether a worktree is dirty. It replaces bothisWorktreeDirtycopies and the freshness check's own call. It returnsunknownwhen git cannot run or exits non-zero.unknown:preserved (worktree status unreadable)instead of claiming uncommitted changes. This check runs before the commits-ahead check, which would otherwise mislabel the reason as "commits ahead of base".unknownas not dirty.checkWorktreeFreshnessstill treats it as not dirty.formatSignalLine(issue, pid, result, { indent })is now insrc/lib/locks/signal-line.tsand exported fromsrc/lib/locks/index.ts.sequant lockscalls it with no indent; the orchestrator calls it with two spaces. Each reason has one text. For a stale PID,sequant runnow prints the longersequant lockswording.chain-resume.integration.test.tsnow calls the realworktreeStatus.-zcheckpoint,phase-executor.ts,qa-stagnation.ts) are untouched.AC verification
rg -n '"status", "--porcelain"\]' src/lib/workflow -g '!*.test.ts' | wc -l→1; the three parsers show no diff-t "worktreeStatus"→ 8 passed, 0 failed. Covers clean, dirty, a heldindex.lock(still reads clean, then dirty), a non-existent path, a folder that is not a repo, and a worktree whose admin directory was removed (the last three readunknown)worktreePreserveReason(abort, "/nonexistent")returns"worktree status unreadable". Aready_for_mergelink whose worktree folder is gone but whose branch is intact resumes on the branch tip with nofailFastsrc/lib/locks/signal-line.test.ts→ 4 passedaccretion-audit dupscommand printsnone, exit 0checkWorktreeFreshnesstests inrun.test.tsand the#1222tests are green and unchangedunknownresult.error || result.status !== 0→"unknown"Note on AC-3: as
/specwarned, the AC-3 filter also matches one unrelatedisAutomatedPRBodytest. There are still 5 new matching tests, so ≥ 2 passes on new tests alone.Mutation-verified: AC-2 — non-zero exit mapped to
clean;src/lib/workflow/worktree-manager.test.ts > worktreeStatus > a non-existent path is unknownfailed, along with 3 otherunknowncases; restored.Mutation-verified: AC-3 — deleted the
unknownreason line; only...worktreePreserveReason keeps a status-unknown path without claiming uncommitted changesfailed; restored.Mutation-verified: AC-4 — dropped the indent prefix;
the indented line is the unindented line with the prefixfailed, along with the stale-PID text case; restored.All three markers parse
Fixes #1475
Runner verification (2026-10-20)
After merging main (through #1509), the runner re-ran AC-1..AC-5 verbatim at 80e63c3:
1nonerun-orchestrator.test.ts: 15 passedThe baseline records
unusedExports339 (from 341).The runner repeated the AC-2 mutation: mapping a non-zero
git statusexit tocleanfailsa non-existent path is unknownplus 3 sibling cases. Restored.QA's dropped finding stays dropped: the
SignalOtherResultre-export is advisory, and knip's count fell overall.🤖 Generated with Claude Code