Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

chore: block merges while Codex reviews are unfinished - #3

Open
aletty wants to merge 5 commits into
masterfrom
codex/wait-for-review-v2
Open

chore: block merges while Codex reviews are unfinished#3
aletty wants to merge 5 commits into
masterfrom
codex/wait-for-review-v2

Conversation

@aletty

@aletty aletty commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Codex can be reviewing while existing checks are green. Extend the required Stack policy check to block unfinished reviews using authenticated bot summary comments, authorized manual requests, and PR and comment eyes reactions. Completed findings remain advisory.

Reconcile on PR and comment events, with manual dispatch available for legacy reaction-only reviews. Preserve existing branch protection and the installed action pin. The controller reads metadata only; GitHub event delivery still leaves a brief detection window.

Validation: 44 policy/controller tests passed locally, including concurrent reviews, spoofed summaries, permission checks, repeat requests, linear API reads, deleted markers, head updates, separate review types, shared heads, and publication races. Tests are included under .github/policy-tests/.

Depends on: none

@aletty
aletty marked this pull request as ready for review September 9, 2026 01:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 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-09-09T02:07:40.560033Z 9f3f467 New commits
ℹ️ 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.

@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: 7139418af0

ℹ️ 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 .github/workflows/stack-policy.yml Outdated
Comment on lines +166 to +169
for (const p of open) {
const comments = await github.paginate(github.rest.issues.listComments, {...args, issue_number:p.number, per_page:100});
const reactions = await github.paginate(github.rest.reactions.listForIssue, {...args, issue_number:p.number, per_page:100});
codex[p.number] = codexReview(comments, reactions);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid refetching every review for every check run

When a repository has N open PRs with distinct head SHAs, the publication loop calls snapshot() once for each of the N checks, and this newly added loop makes every snapshot fetch comments and reactions for all N PRs. The resulting O(N²) paginated API traffic can exhaust the workflow token's API quota or the 10-minute timeout with only tens of open PRs; the catch handler then publishes failures for every check and blocks all merges. Cache or batch the review metadata, or only refresh the PRs relevant to the check being published.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/stack-policy.yml Outdated
Comment on lines +57 to +59
const requests = comments.filter(c => /^\s*@codex\s+(?:security\s+)?review\b/im.test(c.body || ''));
if (requests.some(c => (Date.parse(c.created_at) || Infinity) > completedAt))
return {ok:false, message:'A Codex review was requested; waiting for the bot completion summary.'};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat equal-timestamp review requests as pending

When a new @codex review comment is created during the same timestamp second as the previous completion-summary update, created_at equals completedAt, so this strict > comparison treats the later request as already completed. The request-triggered run can therefore leave Stack policy green until the bot later emits a comment event, especially because adding an eyes reaction alone does not trigger this workflow. Resolve equal timestamps conservatively or use metadata that establishes event ordering so an active review cannot pass.

AGENTS.md reference: AGENTS.md:L12-L12

Useful? React with 👍 / 👎.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant