Resume fails at implement: gitExclude dirties .gitignore + assertCleanWorkingTree throws #52
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
pi-loop fails at implement stage with "working tree is not clean" during resume, despite resume explicitly trusting the current working tree state.
Log
Root Cause
Two independent problems converge on the same error:
gitExcludemodifies.gitignore, dirtying the tree.createRunContext()callscleanPiLoopGitignore()which removes.pi-loop/from.gitignore. Since.gitignoreis tracked, this makes the tree dirty.assertCleanWorkingTree()throws unconditionally during resume. Resume from implement has uncommitted code changes from the previous partial LLM run — exactly the state resume is designed to handle, but the preflight still rejects it.Fix
Remove both
gitExcludeandassertCleanWorkingTreeentirely. Rely on.pi-loop/being in the target repo's.gitignorefor exclusion.Files to change
src/run/services/gitExclude.tssrc/run/services/gitExclude.test.tssrc/run/services/runDirectory.tscleanPiLoopGitignoreimport and callsrc/run/index.tscleanPiLoopGitignoreexportsrc/shared/git/services/captureDiff.ts:(exclude).pi-loopfromDIFF_PATHSPECsrc/shared/git/services/gitState.tsassertCleanWorkingTreefunctionsrc/shared/git/services/gitState.test.tsassertCleanWorkingTreetestssrc/shared/git/index.tsassertCleanWorkingTreeexportsrc/implement/services/runImplementStage.tsassertCleanWorkingTreeimport and callsrc/implement/services/runImplementStage.test.tsAGENTS.md.pi-loop/gitignore documentationIMPLEMENTATION_PLAN.mdImplementation plan
See
docs/fix-remove-gitexclude-plan.md.