Skip to content

Fix PR publication locking Refresh after the head advances - #56

Open
rcosteira79 wants to merge 4 commits into
mainfrom
fix/pr-publication-stale-head
Open

rcosteira79 wants to merge 4 commits into
mainfrom
fix/pr-publication-stale-head

Conversation

@rcosteira79

@rcosteira79 rcosteira79 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

When a PR branch advances after capture, a failed publication can leave a saved pending intent that blocks Refresh and survives restarting DiffCompass. This change lets the reviewer refresh and continue with their comments intact.

  • Save a new publication intent after preflight checks, immediately before the GitHub POST.
  • Look for the existing review receipt before checking the current head, so retries recover a successful publication even after the branch advances.
  • Recover legacy stale-head intents from Refresh or Retry only after a complete successful receipt lookup finds no matching review. Failed lookups and uncertain POST results keep the intent for retry.
  • Roll back in-memory intent changes if saving them fails, and document recovery for existing sessions.

Regression coverage includes approvals, requested changes, neutral suggestion submissions, reloads, preserved comments, paginated receipt recovery, unavailable GitHub reads, and storage failures.

Validation: bun run verify with CI’s Bun 1.3.14 passed: 1,241 tests passed, 13 skipped, no failures, plus TypeScript and browser-script syntax checks.

Live validation against PR #56 used the production browser UI/server and real GitHub responses. Two empty commits advanced the head without changing source. Approval and change-request attempts rejected the stale head, Refresh preserved comments, and an older saved pending session recovered through Refresh. One labelled test-only COMMENT review was published: #56 (review). After intentionally discarding its response, advancing the head again, and reopening the saved session, Retry recovered the same receipt with exactly one remote POST. A second replay forbade all GitHub writes and also passed.

The live run also exposed a missing agent-selection guard in the UI. That guard is fixed; browser recovery now shows its success message with no page errors when no agent is configured. All 86 existing UI tests pass. Temporary test worktrees were removed; the test suggestion was not applied.

Fixes #55.

@rcosteira79 rcosteira79 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted from DiffCompass.

Comment thread docs/usage.md
The saved review remains available; reopening a completed review recreates its
checkout at the recorded PR revision when needed.

If the PR branch changes before publication, refresh the review and confirm the

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If the PR branch changes before publication, refresh the review and confirm the
<!-- DiffCompass #55 live regression test only; do not apply. -->
If the PR branch changes before publication, refresh the review and confirm the

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.

PR review deadlocks when the head moves: a failed publish leaves a pending intent that blocks Refresh

1 participant