Skip to content

Stop wins until the PR request is sent - #2299

Merged
santoshkumarradha merged 23 commits into
app/v3from
c52/stop-beats-publish
Nov 3, 2026
Merged

santoshkumarradha merged 23 commits into
app/v3from
c52/stop-beats-publish

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

What changes

Pressing Stop could still let a PR open. In one real job, Proof finished, the automatic publish was queued, and Stop was recorded about a second later; the PR opened a second after that, while the page still showed Publish "to come".

  • Stop now wins at every point up to the moment the PR request is sent: when Proof finishes, between steps, at publish start, right before the git push, and right before the PR request. The check reads the job fresh under its row lock.
  • On a worker, the same check goes to the factory over a new lease endpoint.
  • If the request was already sent, the job says the PR opened and links it. Nothing is closed automatically, and the person is told. A receipt for a PR that really opened is no longer lost.
  • Run again works after a Stop. The old publisher's late write can only record a PR that really opened.

Limits

  • The gap between the final check and the request itself can't be closed. A Stop landing inside it reads as "the PR opened", with its link.
  • Which of the paths opened that real PR isn't proven, because the moment the request was sent isn't logged. The tests cover each point.
  • A new worker on an older factory has no fresh check, because that factory lacks the endpoint: it publishes as before.
  • If the check gets a transient error it retries three times within two seconds. If it still can't confirm, it does not publish: the job fails and says why, and the person can press Approve again.
  • The desktop still draws a pending Publish step on its own; that needs a change on the app side.
  • Not pressed live.

Validation

  • Red before the fix: stopped job sent 1 PR requests, successful in-flight PR receipt rejected, floor lost the successful PR receipt, Stop recorded before git push, Run again after Stop blocked.
  • internal/factory/..., internal/manual, internal/appwire and whole cmd/codeaf pass, apart from TestFactoryStartBadRepositoryFile, which failed once in the package run and passes 3 of 3 alone.

🤖 Generated with Claude Code

santoshkumarradha and others added 23 commits November 3, 2026 02:57
Publication trusted a captured row and worker lease revocation discarded successful in-flight forge answers. Check the current row at each external write, withdraw queued work, and retain the publishing lease only to settle its receipt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Carry the final publication check to the source seam and validate late receipts through the normal report fold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ipts

Do not treat a stopped CI repair with an older PR as a newly opened PR. This premature shipped transition made recovery appear complete before the repair ran.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply box-generated Go formatting to the existing regression tests and worker check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clear a stopped failure once a validated in-flight PR receipt proves publication succeeded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ordinary stopped jobs have no live lease; a retained publisher can still owe progress metadata before its final receipt. Preserve accounting while refusing to revive its stopped state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Stop heartbeat could arrive after the local publisher finished but before its final flush. Returning false discarded the mirror and its successful receipt. Keep that receipt on the normal final-report path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Carry the final Stop check through push preparation. Retire publisher leases into receipt-only ownership so Run again is immediately available. Preserve legacy endpoint compatibility and bound transient confirmation retries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review found that a slow in-flight PR needs receipt renewal and validation against the stopped run rather than replacement metadata. Receipt heartbeats deliver Stop without draining the new run signals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 3, 2026 10:30
@santoshkumarradha
santoshkumarradha merged commit 77b17cd into app/v3 Nov 3, 2026
@santoshkumarradha
santoshkumarradha deleted the c52/stop-beats-publish branch November 3, 2026 10:30
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