Skip to content

ci(governance): let agents clear high-risk changes - #706

Merged
Pigbibi merged 7 commits into
mainfrom
governance/agent-cleared-high-risk
Nov 5, 2026
Merged

Pigbibi merged 7 commits into
mainfrom
governance/agent-cleared-high-risk

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

AI assistance

Qoder (AI agent) wrote this change from the owner's instruction; Codex reviewed the final head.

What changed

  • AGENTS.md: no change waits on a human label. A high-risk change needs one clearing label, and an agent may add agent-approved itself once the Codex receipt on the current head is completed with no unresolved findings and every other required context is green, then waits for risk-gate to re-evaluate. owner-approved remains for the owner's own confirmation, and agents never add or remove it.
  • .github/workflows/risk-gate.yml:
    • a dedicated record_label job writes the head from a labeled event to an immutable clearing-label commit status, so a label added before a later push cannot clear the new head;
    • that job matches the label addition carried by its own delivery, using the pull_request.updated_at snapshot that arrived with the head, so a delayed run cannot stamp a newer label on another head onto an older one; when the time matches no addition or more than one, it records nothing;
    • the evaluation credits a label only when the record names the label event that is live now on the current head, so a revoked approval is not revived;
    • the Dependabot fast path requires GitHub's own bot identity (dependabot[bot] authored, web-flow committer from noreply@github.com, verified), matching scripts/dependabot_auto_merge_gate.py.
  • Repository configuration: RISK_GATE_OWNER is set and the agent-approved label exists, so the clearing path no longer names nobody.

How verified

  • The gate parses as YAML and the embedded script passes node --check.
  • The recorder and the evaluation were exercised with scenario harnesses: normal and owner labels, other labels and actors, unset approver, closed pull request, missing head, a delayed run whose newer label sits on another head, and same-second ambiguity (records nothing).
  • The current head carries a Codex receipt that is completed with no unresolved findings.

Why

The gate accepted an agent's clearing label, but an unset approver variable and a record that could name the wrong label event meant the path either accepted nobody or could credit an approval the owner had revoked. The rule and the gate now agree, and no change waits on a manual owner label.

Risk

Risk tier T2: governance text and one workflow. The blast radius is this repository's pull-request status publication. Reverting this pull request restores the previous clause and gate.

The gate already accepts agent-approved. Make the rule say so: an
agent clears high-risk changes itself once the current head has a
clean Codex receipt and green contexts, and records the label in the
ledger. No change waits on a human label.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 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 ✅ Completed 2026-11-05T16:27:48.896493Z e952d06 Draft marked ready
ℹ️ 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: bdffa4daa5

ℹ️ 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 AGENTS.md Resolved
…abot contract

A label added before a later push cleared the new head. The label event
time is now compared with the head commit date, so only a label added
after that commit counts. The Dependabot fast path requires the
committer to be the bot account, matching the regression test that the
previous web-flow predicate broke.
A high-risk PR without a clearing label fails risk-gate by design, so
requiring every required context to be green before the label was a
circular prerequisite. The other contexts gate the label; risk-gate is
checked after it.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex 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: 3937b5b99b

ℹ️ 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/risk-gate.yml Resolved
Comment thread .github/workflows/risk-gate.yml Resolved
…tity

A label lives on the pull request, so a later push left it looking
current. The run for the labelled event now records the head from its
payload as a commit status, and later evaluations credit the label
only when the current head carries that record.

Dependabot's real commits are authored by dependabot[bot] and
committed by web-flow from noreply@github.com, the same identity the
auto-merge gate checks, so the fast path stays reachable.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex 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: 32ac85f163

ℹ️ 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/risk-gate.yml Resolved
Comment thread .github/workflows/risk-gate.yml Resolved
…e evaluation

A commit status can be shared by two pull requests, so the record now
names the PR. The record is written by its own job with no
concurrency group, because a superseded evaluation would otherwise
lose the only copy of which head the label was added to. Each label
is validated against the head before owner precedence applies.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 6edd1e080c

ℹ️ 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".

A label can be removed and added again later. Without the event id,
moving the head back to an earlier commit would revive the removed
approval, because the stored record and the live event would be two
different approvals. The recorder stores the event it handled and the
evaluation requires that exact id.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex 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: 3497eded46

ℹ️ 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/risk-gate.yml Resolved
A run queued for head A can start after the label was removed and added
again on head B. Looking up the newest event at execution time then
stamped B's addition onto A. The record now matches the addition whose
time equals the pull request snapshot that carried the head, and writes
nothing when that time matches no addition or more than one.
@Pigbibi

Pigbibi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: e952d0648e

ℹ️ 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".

@Pigbibi
Pigbibi marked this pull request as ready for review November 5, 2026 16:25
@Pigbibi Pigbibi added the agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation label Nov 5, 2026
@Pigbibi
Pigbibi merged commit 3de2e23 into main Nov 5, 2026
9 of 14 checks passed
@Pigbibi
Pigbibi deleted the governance/agent-cleared-high-risk branch November 5, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant