ci: continue a review from the session it saved

OpenCodeReview settles files one by one and records each verdict, but the
workflow deleted every session when the job ended, so a review that ran out of
its token budget had to buy the same files again next time. A large pull
request could never finish.

Keep the session records and the checkout between runs, continue a same-range
review up to two extra rounds, and resume from the last incomplete review of
this very revision. A new push still reviews its own range, and an incomplete
review never anchors an incremental one: that would leave its unfinished files
unreviewed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NwflowerandClaude Opus 5.5 committed 2026-12-04 01:10:21 -07:00
1 parent 7b76330d28
commit fcbc77af57
3 files changed
+237 -20

No files matched your search

+18
View File
@@ -59,6 +59,21 @@ jobs:
path: ${{ runner.temp }}/ocr-bin
key: opencodereview-${{ env.OCR_VERSION }}-${{ env.OCR_SHA256 }}
# Keep the OCR session records and the checkout between runs. A review
# that stops at its token budget continues from here on the next run
# instead of paying for the same files again.
- name: Cache PR review state
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ runner.temp }}/pr-review-state
key: pr-review-state-${{ github.repository }}-${{ github.event.pull_request.number || inputs.pull_number }}-${{ github.run_id }}
restore-keys: |
pr-review-state-${{ github.repository }}-${{ github.event.pull_request.number || inputs.pull_number }}-
- name: Ensure PR review state directories
shell: bash
run: mkdir -p "$RUNNER_TEMP/pr-review-state" "$RUNNER_TEMP/pr-review-state/sessions" "$RUNNER_TEMP/pr-review-state/repos"
- name: Download OpenCodeReview
if: steps.ocr-cache.outputs.cache-hit != 'true'
shell: bash
@@ -86,4 +101,7 @@ jobs:
PR_REVIEW_LLM_PROTOCOL: ${{ vars.PR_REVIEW_LLM_PROTOCOL || 'anthropic' }}
PR_REVIEW_LLM_EXTRA_BODY: ${{ vars.PR_REVIEW_LLM_EXTRA_BODY }}
PR_REVIEW_CODE_SUGGESTIONS: ${{ vars.PR_REVIEW_CODE_SUGGESTIONS }}
PR_REVIEW_STATE_DIR: ${{ runner.temp }}/pr-review-state
PR_REVIEW_SESSION_HOME: ${{ runner.temp }}/pr-review-state
PR_REVIEW_REUSE_INCOMPLETE: "true"
run: node .github/scripts/pr-review.mjs