Skip to content

docs: add Codex review throttling protocol#439

Closed
BigSimmo wants to merge 17 commits into
mainfrom
codex/review-throttling-protocol
Closed

docs: add Codex review throttling protocol#439
BigSimmo wants to merge 17 commits into
mainfrom
codex/review-throttling-protocol

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • add durable Codex review throttling/routing in AGENTS.md
  • add tracked docs for the shared review protocol and branch review ledger
  • update branch cleanup guidance to skip unchanged reviewed branches before diffing
  • link Cursor review skills back to the shared review protocol so skill-triggered reviews do not bypass throttling
  • harden .github/workflows/codex-autofix-review-comments.yml to handle Codex PR review submissions and inline review comments, while deduping by PR number and failing deterministically on GitHub API errors

Why

Codex review behavior was prone to repeated branch reviews and ambiguous auto-fix loops because review rules were split across chat memory, local skills, untracked docs, and a workflow that only covered part of how Codex comments appear on PRs.

Files / areas touched

  • AGENTS.md
  • .github/workflows/codex-autofix-review-comments.yml
  • .cursor/skills/*review*/SKILL.md and Supabase Postgres review guidance
  • docs/branch-review-ledger.md
  • docs/codex-review-protocol.md
  • docs/branch-cleanup-guide.md

Verification

  • Ran git diff --check: passed (no conflict markers or trailing whitespace)
  • Ran rg -n "pull_request_review:|pull_request_review_comment:|codex-autoresolve-pr:|failGitHubApi|issues.listComments|issues.createComment|in_reply_to_id|chatgpt-codex-connector" .github/workflows/codex-autofix-review-comments.yml: passed (matched review triggers, PR-scoped marker, Codex actor guard, reply/auto-request skip paths, and GitHub API error handling)
  • Ran Select-String -Path docs\branch-cleanup-guide.md -Pattern "branch-cleanup|Select-String -Pattern": passed (matched branch+HEAD+scope ledger skip instructions)
  • Ran node "$env:TEMP\verify-codex-autofix-workflow.mjs": passed (10 workflow guard assertions: review triggers, PR-level concurrency, PR-scoped marker, Codex actor guard, reply skip, auto-request skip, listComments/createComment error handling, open-PR guard)
  • Ran python -c "import yaml, pathlib; yaml.safe_load(pathlib.Path('.github/workflows/codex-autofix-review-comments.yml').read_text())": passed (workflow YAML parses)

Checks not run

  • Runtime tests/builds were not run because the follow-up changes are docs/workflow/skill-instruction only and do not touch app behavior.
  • actionlint was not run because it is not installed in this environment.
  • Prettier was not run because node_modules/prettier is not installed in this worktree.
  • No provider-backed app checks were run.

Risks / notes

  • PR checks could still catch GitHub Actions expression issues that local parsing cannot fully validate.
  • This PR makes repository-tracked behavior durable. Machine-local global skills under C:\Users\joshs\.codex\skills are outside the repo and are not part of the PR.

@supabase

supabase Bot commented Jul 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds review governance docs, updates branch cleanup guidance, revises AGENTS workflow rules, and changes the GitHub workflow that auto-resolves Codex review comments.

Changes

Review protocol and branch ledger governance

Layer / File(s) Summary
Codex review protocol document
docs/codex-review-protocol.md, docs/branch-review-ledger.md
Defines review trigger, scope, output, mutation, severity, and ledger lookup rules for branch and PR reviews.
AGENTS.md workflow rules
AGENTS.md
Adds review throttling and routing rules, forbids provider-backed interactions without confirmation, constrains branch cleanup during upload, expands the final report requirements, and revises automatic resolve trigger behavior.
Branch cleanup guide
docs/branch-cleanup-guide.md
Adds ledger-based skip logic to safety rules and reworks the recommended cleanup order to confirm patch content, record reviews, and conditionally remove worktrees.
Skill review protocol updates
.cursor/skills/*/SKILL.md
Adds repository review protocol instructions to the review skill documents so they reference the same throttling, mutation, and ledger rules.
Codex review comment auto-resolve workflow
.github/workflows/codex-autofix-review-comments.yml
Switches the workflow to submitted review events, rewrites source detection and skip logic, and changes duplicate prevention to PR-based markers with source-specific tagging.

Estimated code review effort: 3 (Moderate) | ~25 minutes


🔕 Pre-merge checks override applied

The pre-merge checks have been overridden successfully. You can now proceed with the merge.

Overridden by @BigSimmo via checkbox on 2026-07-09T11:16:06.717Z.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Verification Claims ❌ Error [IGNORED] PR description lists checks under Verification but omits explicit pass/succeeded results for git diff --check and the PyYAML parse; only one item says 'confirmed'. Rewrite each verification line as Ran <command>: passed (or failed) and keep skipped items as Not run: <reason>.
✅ Passed checks (10 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Generated And Sensitive Files ✅ Passed Diff contains only docs, workflow, and skill markdown; no .env, key material, logs, node_modules, .next, or dump files were committed.
Risky Git Or Deployment Actions ✅ Passed PASS: risky actions are confirmation-gated in AGENTS, and the new branch-cleanup docs add safety/ledger checks rather than unapproved destructive steps.
Supabase Project And Schema Safety ✅ Passed PR only adds review-throttling/docs/workflow text; no changes to Supabase project refs, env examples, migrations, schema, RLS, or policies.
Runtime And Package Manager Integrity ✅ Passed Only a workflow comment-handling script changed; no package manager, lockfile, engine-strict, or Node/npm version settings were altered, and repo still pins npm@11.17.0/Node 24.
Api Route Failure Handling ✅ Passed Only changed integration is a GitHub Actions workflow, and it now catches list/create comment failures plus auth/rate-limit/client errors deterministically.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding Codex review throttling protocol guidance.
Description check ✅ Passed The description covers the summary, rationale, touched areas, verification, and skipped checks, though it doesn't use the template's exact checklist layout.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/review-throttling-protocol
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/review-throttling-protocol

Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 9, 2026 09:26
auto-merge was automatically disabled July 9, 2026 09:28

Head branch was pushed to by a user without write access

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/branch-cleanup-guide.md`:
- Around line 44-51: The skip-check in the branch cleanup guide is too loose
because the current lookup uses only BRANCH_NAME, which can incorrectly skip a
required review. Update the instructions around the ledger check to require
matching the branch/ref, the recorded HEAD SHA, and the branch-cleanup scope
together before deciding to skip, using the branch-review-ledger.md lookup flow
and the skip rule wording to make the condition explicit.

In `@docs/codex-review-protocol.md`:
- Around line 23-26: The review protocol currently conflicts by forbidding edits
in pure review runs while also requiring `docs/branch-review-ledger.md` updates
after branch/PR reviews. Update the guidance so the ledger entry requirement
applies only outside pure review mode, or explicitly as a separate post-review
step. Adjust the wording in the protocol section with the review rules so `pure
review`, `branch/PR reviews`, and `docs/branch-review-ledger.md` no longer imply
both behaviors at once.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b4acf46-bd16-44ac-a0e0-81bb90bd6eb4

📥 Commits

Reviewing files that changed from the base of the PR and between 1665b50 and 560013a.

📒 Files selected for processing (4)
  • AGENTS.md
  • docs/branch-cleanup-guide.md
  • docs/branch-review-ledger.md
  • docs/codex-review-protocol.md

Comment thread docs/branch-cleanup-guide.md Outdated
Comment thread docs/codex-review-protocol.md Outdated
@BigSimmo
BigSimmo enabled auto-merge (squash) July 9, 2026 09:38

@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: e426255a57

ℹ️ 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 docs/codex-review-protocol.md
Require branch, HEAD, and scope to match before skipping cleanup reviews, and allow ledger appends as the sole edit during pure review runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 9, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@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: 6251c0101e

ℹ️ 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/codex-autofix-review-comments.yml Outdated
BigSimmo and others added 2 commits July 9, 2026 18:27
Wrap issues.listComments and issues.createComment in explicit try/catch paths that log a clear notice and fail the job deterministically on auth, rate-limit, and client API errors while preserving skip cases.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/codex-autofix-review-comments.yml (1)

112-151: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Asymmetric 403 handling defeats the "keep permission-skip paths green" intent.

listComments runs before createComment and uses the same token. On a 403, failGitHubApi("issues.listComments", ...) calls core.setFailed (Line 35-38), so the run fails hard before ever reaching the soft-skip 403 branch at Line 145-148. If the token lacks comment permissions, it will typically 403 on the read too, so the green permission-skip path is effectively unreachable. Consider treating a 403 on listComments as the same soft skip.

🔧 Suggested soft-skip on read permission failure
             } catch (error) {
+              if (error?.status === 403) {
+                core.warning("Skipping Codex auto-resolve request because this workflow token cannot read PR comments.");
+                return;
+              }
               core.notice(`Failed to list PR comments for #${issue_number} before posting Codex auto-resolve request.`);
               failGitHubApi("issues.listComments", error);
               return;
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codex-autofix-review-comments.yml around lines 112 - 151,
The permission-skip flow is asymmetric because Codex auto-resolve currently
hard-fails on a 403 from github.rest.issues.listComments before it can reach the
existing soft-skip path in github.rest.issues.createComment. Update the
try/catch around listComments in the Codex auto-resolve workflow to treat
error.status === 403 the same way as createComment by logging a warning/notice
and returning early instead of calling failGitHubApi, while keeping
failGitHubApi for other GitHub API errors. Use the existing marker check and
createComment 403 branch as the reference behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/codex-autofix-review-comments.yml:
- Around line 112-151: The permission-skip flow is asymmetric because Codex
auto-resolve currently hard-fails on a 403 from github.rest.issues.listComments
before it can reach the existing soft-skip path in
github.rest.issues.createComment. Update the try/catch around listComments in
the Codex auto-resolve workflow to treat error.status === 403 the same way as
createComment by logging a warning/notice and returning early instead of calling
failGitHubApi, while keeping failGitHubApi for other GitHub API errors. Use the
existing marker check and createComment 403 branch as the reference behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7701b927-a5ab-4f23-9652-0779d0d71d24

📥 Commits

Reviewing files that changed from the base of the PR and between fed1d48 and 8f27df1.

📒 Files selected for processing (14)
  • .cursor/skills/accessibility-review/SKILL.md
  • .cursor/skills/ai-architecture-review/SKILL.md
  • .cursor/skills/api-review/SKILL.md
  • .cursor/skills/code-quality-review/SKILL.md
  • .cursor/skills/design-review/SKILL.md
  • .cursor/skills/frontend-architecture-review/SKILL.md
  • .cursor/skills/performance-review/SKILL.md
  • .cursor/skills/release-readiness-review/SKILL.md
  • .cursor/skills/repo-auditor/SKILL.md
  • .cursor/skills/security-review/SKILL.md
  • .cursor/skills/supabase-postgres-best-practices/SKILL.md
  • .cursor/skills/testing-review/SKILL.md
  • .cursor/skills/ux-review/SKILL.md
  • .github/workflows/codex-autofix-review-comments.yml
✅ Files skipped from review due to trivial changes (13)
  • .cursor/skills/code-quality-review/SKILL.md
  • .cursor/skills/ai-architecture-review/SKILL.md
  • .cursor/skills/api-review/SKILL.md
  • .cursor/skills/testing-review/SKILL.md
  • .cursor/skills/security-review/SKILL.md
  • .cursor/skills/supabase-postgres-best-practices/SKILL.md
  • .cursor/skills/performance-review/SKILL.md
  • .cursor/skills/repo-auditor/SKILL.md
  • .cursor/skills/release-readiness-review/SKILL.md
  • .cursor/skills/accessibility-review/SKILL.md
  • .cursor/skills/ux-review/SKILL.md
  • .cursor/skills/design-review/SKILL.md
  • .cursor/skills/frontend-architecture-review/SKILL.md

BigSimmo and others added 2 commits July 9, 2026 18:42
Use SHA-scoped PR labels and concurrency to prevent duplicate resolve requests, skip non-actionable reviews, document the auto-resolve confirmation exception, and add CI workflow guard checks.

Co-authored-by: Cursor <cursoragent@cursor.com>

@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: 2a99f75281

ℹ️ 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/codex-autofix-review-comments.yml
Document manual re-trigger, add resolve completion checklist, cover top-level PR comments in auto-resolve, and link the review protocol from README.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex auto-resolve requested for PR #439 at 2a99f75.

@codex resolve all review comments using AGENTS.md § Codex GitHub review behavior (Primary PR command).

auto-merge was automatically disabled July 9, 2026 11:05

Head branch was pushed to by a user without write access

@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: d270538513

ℹ️ 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/codex-autofix-review-comments.yml
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex auto-resolve requested for PR #439 at 9227f9e.

@codex resolve all review comments using AGENTS.md § Codex GitHub review behavior (Primary PR command).

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Queue PR/head workflow runs, create SHA labels before applying them, post the resolve comment before the label lock, and skip resolve completion summaries on issue_comment events.

Co-authored-by: Cursor <cursoragent@cursor.com>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 9, 2026
@BigSimmo
BigSimmo enabled auto-merge (squash) July 9, 2026 11:18

@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: 4178268a68

ℹ️ 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 on lines +205 to +209
if (isResolveCompletionSummary(body)) {
core.notice(
"Skipping Codex auto-resolve request because the PR comment looks like a resolve completion summary.",
);
return true;

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 Check severity before summary skip

For Codex top-level PR comments that contain an actionable severity marker but also use one of these common phrases, e.g. P1 ... could not resolve the module, this early completion-summary check returns before hasSeverityFindingMarkers() runs, so the workflow skips the auto-resolve request even though AGENTS.md says actionable top-level findings should trigger it. Move the P0–P3 marker check ahead of the broad summary heuristics, or make the completion-summary detection require the explicit resolve-summary structure.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex auto-resolve requested for PR #439 at 4178268.

@codex resolve all review comments using AGENTS.md § Codex GitHub review behavior (Primary PR command).

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Treat issues.get and listComments permission failures as warnings so the workflow stays green when the token cannot read PR metadata.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BigSimmo

BigSimmo commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

@BigSimmo

BigSimmo commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #444, which merged the minimal PR-level Codex auto-resolve throttle to main. Closing this PR because later auto-agent commits reintroduced SHA-scoped dedupe and kept canceling checks.

@BigSimmo BigSimmo closed this Jul 9, 2026
auto-merge was automatically disabled July 9, 2026 11:30

Pull request was closed

Copilot stopped work on behalf of BigSimmo due to an error July 9, 2026 11:31
@BigSimmo
BigSimmo deleted the codex/review-throttling-protocol branch July 9, 2026 13:01
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.

2 participants