Skip to content

Guard autofix dispatch with current OpenCode review#278

Open
seonghobae wants to merge 3 commits into
mainfrom
codex/guard-autofix-current-head
Open

Guard autofix dispatch with current OpenCode review#278
seonghobae wants to merge 3 commits into
mainfrom
codex/guard-autofix-current-head

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • require current-head OpenCode change requests before dispatching review autofix
  • keep unresolved review threads as supplemental context instead of standalone dispatch evidence
  • add regression coverage for thread-only feedback

Verification

  • py -3.12 -m pytest tests\test_pr_review_fix_scheduler.py
  • py -3.12 scripts\ci\pr_review_fix_scheduler.py --self-test

Copilot AI review requested due to automatic review settings July 1, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the criteria for dispatching automated “review autofix” runs so they only trigger when there is a current-head OpenCode CHANGES_REQUESTED review, while still including unresolved review threads as supplemental context (not standalone evidence).

Changes:

  • Update needs_autofix() to early-return unless the PR has a current-head OpenCode change request that is considered autofixable.
  • Add a regression test ensuring thread-only feedback does not trigger an autofix run.
  • Adjust existing test wording to match the new dispatch criteria.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_pr_review_fix_scheduler.py Adds regression coverage for “thread-only feedback should not dispatch autofix” and updates an existing test’s description to match the new behavior.
scripts/ci/pr_review_fix_scheduler.py Makes needs_autofix() require current-head OpenCode change requests before considering threads as additional context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +117 to +118
if not (has_current_head_changes_requested(pr) and change_request_is_autofixable(pr)):
return False, ()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in d7ea1ee — the skip message in inspect_pr() was updated to "no current-head autofixable OpenCode change request", and the matching assertion in test_fix_inspect_skip_wait_and_error_paths was updated accordingly.

@opencode-agent

opencode-agent Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: d7ea1ee5f17a96c2f6ab5804e7ce3f21210ef22c
  • Workflow run: 28508619714
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human or review-agent thread evidence on the current pull request.
  • Root cause: Reviewer and review-agent feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed reviewer thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE, including bot review agents other than OpenCode itself.

Review thread evidence

Latest unresolved reviewer thread evidence

scripts/ci/pr_review_fix_scheduler.py line 118

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T09:20:08Z

  • Comment URL: Guard autofix dispatch with current OpenCode review #278 (comment)

  • Comment excerpt: 'needs_autofix()' now requires a current-head OpenCode change request to be present, so the skip reason returned by 'inspect_pr()' ("no current-head change request or active unresolved review thread") is now misleading: unresolved threads are no longer standalone dispatch evidence. Update the skip message (and/or the logic that produces it) so it reflects the new gating behavior.

  • Result: REQUEST_CHANGES

  • Reason: unresolved reviewer or review-agent thread(s) were present before approval.

  • Head SHA: d7ea1ee5f17a96c2f6ab5804e7ce3f21210ef22c

  • Workflow run: 28508619714

  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["CI script (3 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (3 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
  Evidence --> S3["Test (2 files)"]
  S3 --> I3["regression suite"]
  I3 --> R3["Review risk: Test (2 files)"]
  R3 --> V3["targeted test run"]
Loading

@seonghobae seonghobae force-pushed the codex/guard-autofix-current-head branch from e1d6a87 to f0c857c Compare July 1, 2026 09:31

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human or review-agent thread evidence on the current pull request.
  • Root cause: Reviewer and review-agent feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed reviewer thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE, including bot review agents other than OpenCode itself.

Review thread evidence

Latest unresolved reviewer thread evidence

scripts/ci/pr_review_fix_scheduler.py line 118

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T09:20:08Z

  • Comment URL: #278 (comment)

  • Comment excerpt: 'needs_autofix()' now requires a current-head OpenCode change request to be present, so the skip reason returned by 'inspect_pr()' ("no current-head change request or active unresolved review thread") is now misleading: unresolved threads are no longer standalone dispatch evidence. Update the skip message (and/or the logic that produces it) so it reflects the new gating behavior.

  • Result: REQUEST_CHANGES

  • Reason: unresolved reviewer or review-agent thread(s) were present before approval.

  • Head SHA: f0c857c6d9ad5101c6f410e86b200c5b8eaa33f6

  • Workflow run: 28507829736

  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["CI script (3 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (3 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
  Evidence --> S3["Test (2 files)"]
  S3 --> I3["regression suite"]
  I3 --> R3["Review risk: Test (2 files)"]
  R3 --> V3["targeted test run"]
Loading

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode reviewed the current-head evidence but found unresolved reviewer or review-agent threads before approval.

Findings

1. HIGH .github/workflows/opencode-review.yml:1 - Unresolved reviewer thread blocks automated approval

  • Problem: OpenCode reached an APPROVE control result, but the approval step found unresolved, non-outdated human or review-agent thread evidence on the current pull request.
  • Root cause: Reviewer and review-agent feedback can arrive after bounded model evidence is prepared, so the approval step must re-query GitHub immediately before publishing an approval.
  • Fix: Address or resolve the listed reviewer thread(s), then re-run OpenCode on the current head.
  • Regression test: Keep the approval gate querying reviewThreads(first: 100) after model output and before create_pull_review APPROVE, including bot review agents other than OpenCode itself.

Review thread evidence

Latest unresolved reviewer thread evidence

scripts/ci/pr_review_fix_scheduler.py line 118

  • Latest reviewer comment: @copilot-pull-request-reviewer at 2026-07-01T09:20:08Z

  • Comment URL: #278 (comment)

  • Comment excerpt: 'needs_autofix()' now requires a current-head OpenCode change request to be present, so the skip reason returned by 'inspect_pr()' ("no current-head change request or active unresolved review thread") is now misleading: unresolved threads are no longer standalone dispatch evidence. Update the skip message (and/or the logic that produces it) so it reflects the new gating behavior.

  • Result: REQUEST_CHANGES

  • Reason: unresolved reviewer or review-agent thread(s) were present before approval.

  • Head SHA: d7ea1ee5f17a96c2f6ab5804e7ce3f21210ef22c

  • Workflow run: 28508619714

  • Workflow attempt: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["CI script (3 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (3 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
  Evidence --> S3["Test (2 files)"]
  S3 --> I3["regression suite"]
  I3 --> R3["Review risk: Test (2 files)"]
  R3 --> V3["targeted test run"]
Loading

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.

3 participants