Skip to content

Wire Final PR verify and Abort on phase failure#24

Merged
maxBRT merged 3 commits into
mainfrom
ship/20260719-132602.330536483
Jul 19, 2026
Merged

Wire Final PR verify and Abort on phase failure#24
maxBRT merged 3 commits into
mainfrom
ship/20260719-132602.330536483

Conversation

@maxBRT

@maxBRT maxBRT commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the Run loop endgame that the stub Final left open: after successful Iterations, Ship now runs a real Final Agent phase and requires an open PR for the Run branch (HasOpenPR via gh). On Implement/Review failure, missing commits, or timeout, the Run Aborts (restore Ticket to Ready for Agent, undo that Ticket's commits, stderr + exit non-zero) and does not continue.

Also skips Final when no Iteration succeeded, and discloses Partial Progress in the Final prompt when the Run stops at max iterations with Ready work remaining.

Linked issues

RISK

  • False Abort on Final (likely until dogfooded): if the Final Agent exits 0 but fails to push/open a PR, Ship reports Abort even though Ticket work is Done and commits remain. Operators may think work was rolled back when it was not.
  • Destructive undo on Abort (medium): UndoToRestorePoint resets Ticket commits; a buggy restore-point capture could drop more history than intended. Assumes a clean/ship-controlled tree (documented MVP assumption).
  • Stuck in-progress labels (low for merge, annoying for ops): Done closes the issue but does not clear in-progress; closed Tickets can still show as claimed in label filters.

QA — stress-test plan for a human

  1. Happy path

    • go test ./... (already green on this branch).
    • Rebuild: go build -o ship ./cmd/ship.
    • With at least one ready-for-agent Ticket, run ./ship and confirm stdout shows Iterations, then Final, and that a PR appears for the Run branch (gh pr list --head <branch>).
    • Confirm gh pr view body/links match Done Tickets when Final opens the PR.
  2. Edges / failure cases

    • Force Implement to produce no commit (or kill the Agent mid-phase) and confirm Abort: Ticket returns to ready-for-agent, branch HEAD rewinds to the restore point, stderr contains Abort:, exit code non-zero, no further Tickets/Final.
    • Run with --max-iterations 1 while multiple Ready Tickets exist; Final prompt/path should treat Partial Progress.
    • Empty Ready queue: ./ship should print No Ready for Agent Tickets and exit 0 without creating a branch/PR.
  3. Out of scope

Made with Cursor

maxBRT added 3 commits July 19, 2026 09:29
After Iterations stop, run the Final Agent prompt (disclosing Partial Progress when max iterations left work queued) and require an open PR for the Run branch before succeeding.
Match the issue #11 "when there was work" gate so MaxIterations 0 (or any empty done path) does not invoke Final or require a PR.
Failed Implement/Review, missing commits, and timeouts now restore the
Ticket to Ready for Agent, reset to the restore point, and return a clear
Abort error so the Run does not continue.
@maxBRT
maxBRT merged commit 4563293 into main Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant