{"record":{"id":"f980a000c4631a87","repo":"Hmbown/CodeWhale","slug":"pull-request-changed-during-review-no-current-pr-review-or","errorCode":null,"errorMessage":"Pull request changed during review; no current-PR review or receipt can be accepted. Run the review again.","messagePattern":"Pull request changed during review; no current-PR review or receipt can be accepted\\. Run the review again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/review_pr.rs","lineNumber":113,"sourceCode":"pub(crate) fn fetch_view(\n    number: u32,\n    repo: Option<&str>,\n    workspace: &Path,\n) -> Result<GhPullRequest> {\n    view_with(number, repo, &mut |program, args| {\n        run_command(workspace, program, args)\n    })\n}\n\nfn same_revision(expected: &GhPullRequest, current: &GhPullRequest) -> Result<()> {\n    if expected.head_sha != current.head_sha\n        || expected.base_sha != current.base_sha\n        || expected.changed_files != current.changed_files\n        || expected.additions != current.additions\n        || expected.deletions != current.deletions\n        || expected.url != current.url\n    {\n        bail!(\n            \"Pull request changed during review; no current-PR review or receipt can be accepted. Run the review again.\"\n        );\n    }\n    Ok(())\n}\n\npub(crate) fn ensure_current(\n    number: u32,\n    repo: Option<&str>,\n    workspace: &Path,\n    expected: &GhPullRequest,\n) -> Result<()> {\n    same_revision(expected, &fetch_view(number, repo, workspace)?)\n}\n\n/// Model-only representation of an already verified complete diff. Keep the\n/// original for revision checks, fingerprints and comment anchors. Embedded\n/// binary payloads are not meaningful text input; their headers retain paths,","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/review_pr.rs#L95-L131","documentation":"same_revision compares the PR snapshot captured at review start (expected) with a fresh snapshot (current): number, state, title, base/head SHAs, changed_files, additions, deletions, and url must all match. If any differ, the PR mutated while the review ran, so a review comment or receipt could be attached to the wrong revision; the tool rejects both rather than accept a stale result.","triggerScenarios":"Calling ensure_current (via fetch_view's re-view) or diff_with again after the PR's head moved, base changed, files were pushed, or the PR was edited between the initial view and the final check.","commonSituations":"A teammate force-pushes the PR branch mid-review; CI bot rebases the branch; reviewer keeps the review open across a base-branch sync; rerunning receipt validation after the PR was merged/closed and its state flipped.","solutions":["Run the whole review again on the now-current revision — this is the intended recovery and the only way a review is accepted","Check `git ls-remote origin <pr-branch>` vs the pinned head_sha to identify what moved; coordinate so nobody pushes during review windows","If reviewing via automation, snapshot the PR and complete review in one short-lived run without intervening pushes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// re-fetch and compare before submitting a review\nlet cur = gh_view(num)?;\nif cur.head_sha != pinned.head_sha || cur.base_sha != pinned.base_sha || cur.changed_files != pinned.changed_files {\n    return Err(\"PR moved; rerun review from scratch\".into());\n}","typeGuard":null,"tryCatchPattern":"match ensure_current(&expected) {\n    Err(e) if e.to_string().contains(\"changed during review\") => {\n        // discard stale review, start a fresh run\n        rerun_review(number)?;\n    }\n    other => other?,\n}","preventionTips":["Freeze the PR branch (no pushes) for the review window or use GitHub's branch protection lock","Automate reviews in one short-lived run immediately after fetching the snapshot","Re-run the whole review rather than patching a stale receipt"],"tags":["github","pull-request","concurrency","stale-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}