Skip to content

feat(ai-review): state-aware PR verdict, explicit APPROVE/REQUEST_CHANGES#4

Merged
vklimontovich merged 1 commit into
mainfrom
feat/state-aware-pr-review
May 8, 2026
Merged

feat(ai-review): state-aware PR verdict, explicit APPROVE/REQUEST_CHANGES#4
vklimontovich merged 1 commit into
mainfrom
feat/state-aware-pr-review

Conversation

@vklimontovich
Copy link
Copy Markdown
Contributor

Summary

  • Bot now fetches existing PR review threads before deciding the verdict and treats resolved threads as previously-handled — won't re-raise findings the maintainer already chose to close.
  • Explicit GitHub review event mapping in the prompt:
    • event=APPROVE when no actionable issues remain (this is what unblocks branch protection's "needs an approval" gate on clean re-reviews)
    • event=REQUEST_CHANGES only for new unaddressed issues
    • event=COMMENT for informational-only reviews

Why

Previously the prompt said "post a concise positive review" when clean, without specifying the event. Codex defaulted to event=COMMENT, which doesn't satisfy branch protection's approval requirement. A PR could have all its review threads resolved and still be blocked indefinitely, because the bot never flipped its verdict to APPROVE.

Real-world example: jitsucom/jitsu#1289 — six bot review threads, all resolved (code fixes for some, maintainer "too much" rationale on one). Bot kept posting CHANGES_REQUESTED on subsequent runs because each fresh run re-evaluated the diff without context from the resolved threads. PR had to be unblocked via admin review-dismissal — a manual workaround for a fixable prompt issue.

After this change

  1. First run finds an issue → REQUEST_CHANGES
  2. Author fixes + resolves the thread
  3. Push triggers re-review → bot sees thread resolved + no new issues → APPROVE
  4. Branch protection cleared, no manual dismissal needed

Test plan

  • After merge + tag, point one Jitsu repo's ai-review.yml at the new tag
  • Open a small test PR with one fixable issue
  • Verify first review is CHANGES_REQUESTED
  • Resolve the thread, push a fix
  • Verify next review is APPROVE and the PR is no longer blocked on review

…NGES

Previously the prompt told Codex to "post a concise positive review" when
clean, without specifying the GitHub review event. Codex defaulted to
event=COMMENT, which doesn't satisfy branch protection's "needs an
approval" gate — so even clean re-reviews never unblocked merge.

Two changes to the PR-mode section of the prompt:

1. Before deciding, the bot now fetches the PR's existing review threads
   and treats resolved ones as previously-handled. It won't re-raise a
   finding the maintainer already chose to close.

2. Explicit event mapping:
   - event=APPROVE when no actionable issues remain
   - event=REQUEST_CHANGES only for new unaddressed issues
   - event=COMMENT for informational-only reviews

End result: first run finds an issue → REQUEST_CHANGES. Author fixes
and resolves the thread. Push triggers re-review → bot sees thread
resolved + no new issues → APPROVE → branch protection cleared.
Copy link
Copy Markdown

@jitsu-code-review jitsu-code-review Bot left a comment

Choose a reason for hiding this comment

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

Reviewed the workflow prompt update in .github/workflows/ai-review.yml.

No actionable correctness, security, or regression issues found in this change. The new instructions are consistent with the intended PR re-review behavior (explicit event selection and handling of resolved threads).

@vklimontovich vklimontovich merged commit 1c7a4af into main May 8, 2026
1 check passed
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