Repository navigation
fix(#879): fail exec on uncommitted-only work and make PR-creation failure fatal - #889
Merged
admarble merged 6 commits intoAug 4, 2026
Conversation
…ilure fatal Closes #534's empty-branch escape via a new route. Two independent gaps: 1. hasExecChanges treated a dirty tree as exec success — but uncommitted work cannot rebase, push, or become a PR. Add classifyExecChanges (a three-state discriminated result: commits/uncommitted/none/unknown); exec now FAILS on both 'none' and 'uncommitted', naming the dirty paths so the work is discoverable from the run log. The guard is read-only, so a failed phase leaves the worktree and its dirty files untouched. Extend the same classifier to the ready gate (new UNCOMMITTED_ONLY reason, exit code 2, distinct from NO_IMPLEMENTATION). 2. A failed createPR printed a warning while the issue still reported success — a run could 'pass' with no PR. executeIssue now records prCreationError and returns success:false; the batch loop flips the run log status to failure via LogWriter.markIssueFailed, and the summary names the PR error as the failure reason. Entire-Checkpoint: 337b1a32e7c0
7 tasks
QA (AC_NOT_MET) found the run-log-status half of the fix was attached to a dead code path: markIssueFailed was called only in executeBatch, which has zero live callers. The real `sequant run` path is RunOrchestrator.executeOneIssue, which finalized issues via setPRInfo + completeIssue but never markIssueFailed — so on a real run a post-QA createPR failure left the persisted run-log status at `success` (AC-5/AC-7 unmet on the live path). Extract a single recordIssueCompletion(logWriter, result, issueNumber) helper that does setPRInfo → markIssueFailed (on prCreationError) → completeIssue, and route BOTH executeBatch and the live executeOneIssue through it so the two batch loops cannot drift again. Add spy-based regression tests asserting the helper marks the issue failed (before completing) on a PR-creation failure and records PR info without flipping status on success. Entire-Checkpoint: b8d48afcacc7
…xec-that-leaves-work-uncommitted-reports-
…ation Merging main brought in #856, which reworked completeIssue to re-derive an issue's status from its phase list at completion time (forcing failure only for aborts). That silently defeated #879's markIssueFailed, which seeded the slot status to failure: completeIssue overwrote it back to success from the all-green phase prefix, so a PR-creation failure no longer counted under failed (AC-5/AC-7) -- reproduced by the two markIssueFailed tests failing only in the merged suite. Track forced failures in a WeakSet keyed on the issue slot and honor it in completeIssue alongside abort, so markIssueFailed's override wins over the phase-derived status. Covers both the numbered and legacy currentIssue paths. Entire-Checkpoint: a43e194f6eeb
…ion, live-path completion test Three gaps from the /qa review: - CHANGELOG: add the [Unreleased] > Fixed entry for the two user-facing behavior changes (exec fails on uncommitted-only work naming the preserved paths; a failed createPR fails the run and is counted under failed). - Deprecate executeBatch (@deprecated): no live caller remains — it survives only as a commands/run-compat re-export. The doc names the constraint that any future completion path must go through recordIssueCompletion, so the #879 status-drift class cannot silently return via a third loop. - Test the LIVE completion path: recordIssueCompletion had unit coverage, but the #879 defect was executeOneIssue (what `sequant run` actually executes) not calling the flip at all. New tests drive executeOneIssue itself with only runIssueWithLogging mocked and the real helper in between. Mutation-verified: reverting executeOneIssue's completion block to the pre-#879 bare setPRInfo+completeIssue form fails exactly the new test "flips the run-log status when the result carries a prCreationError" (1 failed, 4 passed); restored, all 5 pass. Claude-Session: https://claude.ai/code/session_018ZNB3A5b3f12RwwfmYncvc
…xec-that-leaves-work-uncommitted-reports- # Conflicts: # CHANGELOG.md
admarble
deleted the
feature/879-fix-run-exec-that-leaves-work-uncommitted-reports-
branch
August 4, 2026 04:05
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
Closes #534's empty-branch escape, reopened via a new route (exec finishing with work uncommitted). Two independent gaps, both fixed:
hasExecChangestreated a dirty tree as exec success. But uncommitted work cannot rebase, push, or become a PR — so a run "passed" with no commits and no PR. NewclassifyExecChanges()returns a three-state discriminated result (commits/uncommitted/none/unknown); exec now fails on bothnoneanduncommitted, naming the dirty paths so the work is discoverable from the run log. The guard is read-only (git rev-list+git status), so a failed phase leaves the worktree and its dirty files byte-identical.hasExecChangesis kept as a thin boolean wrapper. The ready gate uses the same classifier (newUNCOMMITTED_ONLYreason, exit code 2, distinct fromNO_IMPLEMENTATION).A failed
createPRwas a non-fatal warning while the issue reported success.executeIssuenow recordsprCreationErrorand returnssuccess: false; the batch loop flips the run-log status tofailurevia newLogWriter.markIssueFailed, and the summary names the PR error as the failure reason.--no-pris unaffected (shouldCreatePRalready gates it).Design note honored: exec fails rather than auto-commits — an auto-commit would sweep up scratch files and author a PR nobody wrote.
.sequant/state.jsonis deliberately untouched (chain-resume keys off it).Pre-PR AC Verification
hasExecChangesdistinguishes "no work" from "uncommitted only"; exec fails on bothphase-executor.tsclassifyExecChanges+ exec guard;phase-executor.test.tsformatUncommittedExecError; unit + integration testsphase-executor.integration.test.tsbyte-identical assertionUNCOMMITTED_ONLY, distinct fromNO_IMPLEMENTATIONready-gate.ts; exit code 2 inready.ts;ready-gate.test.ts+ready.test.tscreatePRsets issue run status failed; summary counts it under failedbatch-executor.tsoverallSuccess;run-display.ts;batch-executor.test.ts+run-display.test.tsphase-executor.integration.test.ts(realgit)createPRfailure → non-success issue status in run loglog-writer.test.tsmarkIssueFailedMutation verification (gate tests)
Per CLAUDE.md, each new gate test was mutation-verified — the asserted behavior was broken, exactly the intended test failed, then restored:
success: truefinish("UNCOMMITTED_ONLY")→NO_IMPLEMENTATIONoverallSuccess = success(ignoreprCreationError)markIssueFailedsetssuccessprCreationErrorfrom summary fallbackTest plan
npm run build— cleannpm run lint— cleannpm test(touched files): 491 passed across 9 files incl. real-git integrationCloses #879