Skip to content

feat[ci]: add AI review disposition checks - #24

Open
liaoxiang0304 wants to merge 21 commits into
mainfrom
feat/Ai-dispose
Open

liaoxiang0304 wants to merge 21 commits into
mainfrom
feat/Ai-dispose

Conversation

@liaoxiang0304

@liaoxiang0304 liaoxiang0304 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

为 PR 提供一个固定名称 AI Review / Disposition Check 的 AI 审查处理门禁。每个配置的机器人完成审查、所有应处理线程都有授权人工的有效模板及证据时才通过;conversation resolution 和人工 approval 继续由 GitHub 原生规则单独要求。

PR Checks 列表使用一个 Commit Status context,显式复查先发布真正的 pending,再更新为 success / failure。后台路由、评估、发布和收尾合并为一个 worker,不再创建自定义 Check Run 或 superseded 项。状态历史仍保留,但不增加当前 PR 的同名条目。

事件入口只在默认分支后台运行:已有 CI 完成、顶层评论、Issue 变化及手动 dispatch 触发复查,每五分钟扫描补全 review、行内回复和 head 变化。定时扫描读取实时证据、权限与 Issue;未变化的终态不重复写入。所有入口共用仓库级串行队列,业务阻断通过唯一 PR 状态表达,执行器错误才触发恢复。接近 GitHub 同一 SHA/context 的 1000 次状态写入上限时保持阻断并提示新提交。

验证(最终候选 e774814f6bbe9f520c3abb6e39d0b1b89e82dfa9):

  • 146 项单元测试通过;Ruff lint/format、actionlint、git diff --check 通过;候选提交 CI通过。
  • 隔离真实 API 验证使用 Actions Token,四轮检查完成8次 pending/success/failure 写入,并验证中断收尾、旧运行不能覆盖以及真实 PR 缺失机器人时的业务阻断。未变化扫描追加0条状态。
  • 隔离目标 PR #25最终 GraphQL rollup 只有1个 StatusContext,原生目标 Check 数为0。此测试仅证明状态生命周期及实时读取行为,不声称真实 AI 已完成审查。测试 PR [SANDBOX] verify one AI disposition row #25/[SANDBOX] run AI disposition status API probe #26 已关闭,证据保留在运行日志及 artifact 中。
  • 首轮 API 探针发现 combined-status 响应不含 creator,已改读带发布者的最新状态记录,并增加与真实 API schema 一致的回归测试。

接入与迁移:

  • 仅修改本共享仓库;PallasKernels、VR_DexCopilot 的代码、工作流、变量和规则均未修改或部署。
  • 下游必须同步新版 caller / recovery,删除旧 AI Review Events 收集器,改授 statuses: write,并匹配现有 CI 的 workflow 名称。仅升级共享脚本不能隐藏下游旧工作流产生的 Checks。
  • 已有旧 Check Run 的 PR 需在接入更新后推送一个新提交,再验收单行显示;不清理历史记录。同名 Check Run 与 Status 同时存在时 GitHub 会同时判定。
  • 详见接入文档。

边界:五分钟是计划扫描频率,仍受 GitHub 排队/调度影响;事件发生到 worker 处理前旧状态可能短暂可见。API 所有权读取与写入不原子,硬取消/API 不可用仍存在异步窗口。只支持 GitHub.com 同仓库 PR/Issue;同一 head 被多个 PR 共用、fork 和 merge queue 不在本次验收范围。

JIRA: PDIST-770

leolordwz and others added 8 commits October 15, 2026 14:41
Problem:
  - AI review findings need explicit, auditable handling before merge.

Solution:
  - Require each configured bot to complete review for the current PR head.
  - Validate authorized dispositions, supporting evidence, and resolved threads.
  - Add a reusable workflow, integration examples, and setup documentation.

Test:
  - Add unit tests for disposition rules, permissions, pagination, and API failures.
  - Tests not run for this draft.

JIRA: PDIST-770
Problem:
  - Every event scanned all open PRs and shared a repository-wide queue.

Solution:
  - Require a positive PR number and evaluate only that PR.
  - Pass review-event PR numbers via collector run names.
  - Serialize check updates per PR and simplify the GitHub.com client.

Test:
  - Python 3.11: 40 unit tests passed.
  - 12 workflow routing and concurrency cases passed with @actions/expressions.
  - Workflow YAML contracts and git diff --check passed.
  - Live Bot review and target-repository deployment were not run.

JIRA: PDIST-770
Restore documentation, summary punctuation, and Unicode test fixtures to the exact UTF-8 contents validated locally.

Test:
  - Python 3.11: 40 unit tests passed on these exact contents.
  - 12 workflow expression cases passed.

JIRA: PDIST-770
Problem:
  - Jira URLs were accepted without checking that a follow-up item exists.

Solution:
  - Remove Jira options and configuration from the checker and callers.
  - Accept only readable open GitHub issues verified through the Issues API.
  - Reject missing, closed, inaccessible issues and pull requests.

Test:
  - Python 3.11: 44 unit tests passed.
  - 12 workflow expression cases passed.
  - Four read-only live Issue API probes passed; Check writes were mocked.

JIRA: PDIST-770
Problem:
  - Human reviewer threads were skipped by the disposition check.

Solution:
  - Include published inline threads from humans other than the PR author.
  - Reuse the existing template, evidence, permission and resolution checks.
  - Require a fresh disposition after the originating reviewer updates a thread.
  - Preserve configured bot identity precedence and the bot completion protocol.

Test:
  - Python 3.11: all 57 tests passed, including 50 disposition tests.
  - AST checks confirm both bot completion loops and other functions are unchanged.
  - git diff --check passed.

JIRA: PDIST-770
Problem:
  - Human follow-up discussion invalidated an existing disposition.
  - Fix required manually copying a full commit SHA.

Solution:
  - Invalidate human dispositions only when the root review comment changes.
  - Accept current-repository commit URLs alongside full SHAs.
  - Reuse PR commit membership checks without extra API requests.
  - Keep AI comment freshness and bot completion rules unchanged.

Test:
  - Python 3.11: all 63 tests passed.
  - Regression cases cover human follow-ups, root edits and Unresolve.
  - Commit URL cases cover repository, host, SHA, force-push and API request counts.
  - AST checks confirm unchanged bot completion loops and existing API reads.
  - git diff --check passed.

JIRA: PDIST-770
Problem:
  - Requiring a current-head review marker blocks bots that review once per PR.
Solution:
  - Accept submitted reviews or exact successful Codex/infiscale completion comments.
  - Keep disposition evidence, reply permissions and conversation resolution checks.
Test:
  - 71 unit tests, Ruff checks and 48 real Codex comment replays pass.
JIRA: PDIST-770
@infiscale-bot

Copy link
Copy Markdown

👀 收到,开始 review

检测到 PR 需要 review,正在处理,通常需要 5-10 分钟。完成后会在变更行上留 inline comment。


🤖 Hermes Agent 自动 review

Comment thread scripts/check_ai_review_disposition.py Resolved
Comment thread scripts/check_ai_review_disposition.py Resolved
@liaoxiang0304

Copy link
Copy Markdown
Collaborator Author

@infiscale-bot review
@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T11:20:19.857160Z a3d5881 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@infiscale-bot

Copy link
Copy Markdown

👀 收到,开始 review

已收到 @infiscale-bot 的重新 review 请求,正在对当前最新代码做 review,通常需要 5-10 分钟。完成后会在变更行上留 inline comment。


🤖 Hermes Agent 自动 review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: faa4db5ed9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_ai_review_disposition.py Resolved
Comment thread scripts/check_ai_review_disposition.py Resolved
Problem:
  - Resolve and Unresolve do not trigger the disposition workflow, leaving stale Check results.

Solution:
  - Validate AI review completion and disposition replies independently of resolution.
  - Exclude isResolved from snapshots so resolution changes cannot invalidate the second read.
  - Require GitHub native conversation resolution alongside the required Check in setup docs.

Test:
  - Python 3.11: all 71 unit tests passed.
  - Ruff lint and format checks passed for both changed Python files.
  - Regression coverage includes all dispositions and Resolve/Unresolve during evaluation.
  - Patch whitespace check and AST checks for unchanged bot identity/completion logic passed.

JIRA: PDIST-770
@liaoxiang0304 liaoxiang0304 changed the title Feat/ai dispose feat[ci]: add AI review disposition checks Oct 22, 2026
Track review rounds and dismissal fallback, restrict Deferred to open issues
in the PR repository, and recheck open PRs when an issue changes.
Prevent older evaluations from replacing newer check results and revalidate
permissions and tracking issues before success.

Validation: 94 unit tests, Ruff lint/format, actionlint, and a read-only
snapshot of the live PR review data.
@liaoxiang0304

Copy link
Copy Markdown
Collaborator Author

@infiscale-bot review
@codex review

@infiscale-bot

Copy link
Copy Markdown

👀 收到,开始 review

已收到 @infiscale-bot 的重新 review 请求,正在对当前最新代码做 review,通常需要 5-10 分钟。完成后会在变更行上留 inline comment。


🤖 Hermes Agent 自动 review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be25a22a1c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check_ai_review_disposition.py Resolved
Comment thread scripts/check_ai_review_disposition.py Resolved
Comment thread docs/examples/ai-review-disposition.yml Resolved
@liaoxiang0304

Copy link
Copy Markdown
Collaborator Author

@infiscale-bot review
@codex review

@infiscale-bot

Copy link
Copy Markdown

👀 收到,开始 review

已收到 @infiscale-bot 的重新 review 请求,正在对当前最新代码做 review,通常需要 5-10 分钟。完成后会在变更行上留 inline comment。


🤖 Hermes Agent 自动 review

Comment thread scripts/check_ai_review_disposition.py Resolved
Problem:
  - Interrupted evaluations can leave stale or unfinished merge checks.
  - Edited comments and truncated commit lists can invalidate disposition evidence.

Solution:
  - Pre-register sweep checks, evaluate four PRs in parallel, and recover interrupted runs.
  - Validate comment editors, complete large PR commit lists, and bound read retries.
  - Document Codex completion precedence and asynchronous recovery limits.

Test:
  - Python 3.11: 123 unit tests passed.
  - Ruff lint/format, actionlint, and git diff --check passed.
  - Read-only GitHub probes verified editor fields and all 794 comparison commits.

JIRA: PDIST-770
Problem:
  - Repeated evaluations create superseded Checks on the same PR head.
  - Single-PR, sweep and recovery writers can overlap.

Solution:
  - Reopen and update one managed Check ID per PR head without renaming history.
  - Route every entry point through the same serialized per-PR worker queue.
  - Keep different PRs parallel and re-evaluate live state during recovery.

Test:
  - Python 3.11: 124 unit tests passed, including 20 evaluations reusing one Check.
  - Ruff lint/format, actionlint and git diff --check passed.

JIRA: PDIST-770
Problem:
  - GitHub retains a completed Check's conclusion when only its status changes.
  - A reused Check can otherwise remain successful while evaluation is running.

Solution:
  - Publish a temporary failure with a Checking title before re-evaluation.
  - Reuse the same ID for interruption cleanup and refresh completion timestamps.
  - Document the live REST and GraphQL reset limitations.

Test:
  - Python 3.11: 126 unit tests passed; Ruff lint/format and diff checks passed.
  - Real sandbox probes confirmed status-only and null resets do not revoke success.

JIRA: PDIST-770
Problem:
  - AI disposition exposed helper checks and could not reset completed results to pending.

Solution:
  - Publish one fixed commit status through a serialized background worker.
  - Preserve review policies and revalidate live evidence before passing.
  - Replace PR event collectors with background triggers and five-minute scans.
  - Skip unchanged scans and block before exhausting the status update quota.
  - Document the caller migration required for a single visible PR check.

Test:
  - 141 unit tests passed, including repeated pending/success/failure transitions.
  - Ruff lint/format, actionlint, and git diff --check passed.

JIRA: PDIST-770
Problem:
  - GitHub combined statuses omit creator, preventing repeated disposition updates.

Solution:
  - Read newest-first full status records and stop at the latest matching context.
  - Model the distinct list and combined response schemas in the test fixture.

Test:
  - Live Actions API probe reproduced the missing creator field.
  - 143 unit tests passed, including ownership and bounded history reads.
  - Ruff lint/format and git diff --check passed.

JIRA: PDIST-770
liaoxiang0304 added a commit that referenced this pull request Oct 28, 2026
Problem:
  - The first live probe exposed an incomplete creator schema in combined statuses.

Solution:
  - Pin the worker to the corrected PR #24 candidate and retain the same isolated target.

Test:
  - Rerun pending, success, failure and interruption transitions with the Actions token.

JIRA: PDIST-770
Problem:
  - Expected review blocks could cause an unnecessary recovery scan after every poll.

Solution:
  - Report business failures through the single PR status while treating publication as successful execution.
  - Keep API errors, interrupted verification, and quota exhaustion eligible for recovery.

Test:
  - 146 unit tests passed, including background blocking and execution error cases.
  - Ruff lint/format, actionlint, and git diff --check passed.
  - Live API verification of the status lifecycle passed on the prior publisher implementation.

JIRA: PDIST-770
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