Skip to content

ci: add exact-head Codex review gate - #97

Merged
max23468 merged 13 commits into
mainfrom
codex/codex-review-gate-clean
Aug 6, 2026
Merged

ci: add exact-head Codex review gate#97
max23468 merged 13 commits into
mainfrom
codex/codex-review-gate-clean

Conversation

@max23468

@max23468 max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Cosa cambia

  • aggiunge il gate codex-review exact-HEAD allineato a SyncBay e corretto sui casi limite emersi in review
  • esegue soltanto il codice di main tramite pull_request_target e checkout fissato
  • lega review, finding, errori e reazioni allo SHA e al tentativo corrente
  • rimuove integralmente la legacy Codex feedback inbox: workflow, script, helper, test e documentazione
  • aggiunge test dinamici e statici senza nuove dipendenze

Verifiche

  • npx vitest run test/codex-review-gate.test.mjs test/workflow.test.ts test/security.test.ts
  • npm test (83 test)
  • npx tsc -p tsconfig.json --noEmit
  • npm run build

Bootstrap

Questa PR introduce il workflow pull_request_target: GitHub esegue la versione presente sul branch predefinito, quindi il nuovo gate non è attivo su questa stessa PR. Il bootstrap usa i check esistenti e una review Codex esplicita; dopo il merge il workflow verrà verificato via dispatch sullo SHA esatto.

Isolamento

Sostituisce il solo scope gate della PR #96, la cui branch ha ricevuto commit concorrenti estranei. Questa PR parte dall’ultimo SHA gate-only e non include quei file.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@max23468
max23468 marked this pull request as ready for review August 6, 2026 13:46
@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 36b7f0b696

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

…te-clean

# Conflicts:
#	docs/DECISIONS.md
#	docs/INDEX.md
#	docs/TOOLCHAIN.md
#	docs/decisions/0006-gate-codex-review-exact-head.md
#	scripts/codex-review-gate.mjs
#	test/codex-review-gate.test.mjs
@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner 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: 9af5ca5e46

ℹ️ 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/codex-review-gate.mjs Outdated
Comment on lines +98 to +103
: !requiresReviewedCommit || exactEyesAt > 0) &&
timestamp(requestedAt) > 0 &&
timestamp(comment.created_at) >= timestamp(requestedAt) &&
now - timestamp(requestedAt) >= 30_000 &&
timestamp(comment.created_at) >= latestEyesAt &&
timestamp(comment.created_at) >=
(commit ? timestamp(requestedAt) : requiresReviewedCommit ? exactEyesAt : latestEyesAt) &&

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 Non associare gli errori solo tramite l'orario

Se due invocazioni @codex review si sovrappongono sullo stesso SHA, un errore generico e senza Reviewed commit della prima può essere pubblicato dopo la reazione eyes sulla seconda: questa condizione lo attribuisce al tentativo più recente e imposta erroneamente codex-review a failure. Il timestamp prova soltanto l'ordine di pubblicazione, non l'appartenenza all'invocazione; accetta questi errori solo quando esiste un legame non ambiguo con la richiesta corrente.

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner 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: 69f7769985

ℹ️ 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/codex-review-gate.mjs Outdated
(commit
? headSha.startsWith(commit)
: !requiresReviewedCommit && timestamp(requestedAt) > 0) &&
: !requiresReviewedCommit || (unambiguousInvocation && exactEyesAt > 0)) &&

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 Disambigua anche i tentativi iniziali sovrapposti

Nel percorso opened/ready_for_review, main passa requiresReviewedCommit: false, quindi questo ramo accetta l'errore senza consultare unambiguousInvocation: se due @codex review si sovrappongono, un errore generico della prima pubblicato dopo la reazione eyes della seconda imposta ancora codex-review a failure. Nuova evidenza rispetto al commento precedente: il conteggio introdotto dal commit protegge solo i percorsi con requiresReviewedCommit: true; applica la stessa disambiguazione anche alle review iniziali.

AGENTS.md reference: AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@github-actions github-actions Bot mentioned this pull request Aug 6, 2026
24 tasks

@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: 46510ce0f2

ℹ️ 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 340 to 341
if (result.state !== "pending") {
await setStatus(repository, headSha, result.state, result.description);

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 Non chiudere il polling al primo esito pulito

Quando due review Codex si sovrappongono sullo stesso HEAD, la seconda può produrre un esito pulito mentre la prima sta ancora generando commenti: questo ramo pubblica subito success e termina il polling. Poiché .github/workflows/codex-review-gate.yml non si attiva su pull_request_review o pull_request_review_comment, un finding P0-P3 pubblicato successivamente dalla prima review non viene più rilevato e lo status resta verde, nonostante i finding correnti debbano prevalere; attendi la conclusione di tutti i tentativi correnti, oppure riattiva il gate sui nuovi segnali Codex, prima di finalizzare il successo.

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner 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: 8273fbb2e3

ℹ️ 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-review-gate.yml Outdated

concurrency:
group: codex-review-${{ github.event.pull_request.number || inputs.pull_request }}
group: codex-review-${{ github.event.pull_request.number || inputs.pull_request }}-${{ startsWith(github.event_name, 'pull_request_review') && github.run_id || 'poll' }}

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 Impedisci al polling di sovrascrivere un finding tardivo

Quando un finding arriva tra l'ultima reviewSignals() del polling e il successivo setStatus(success), il suffisso github.run_id fa eseguire il job pull_request_review* in parallelo al polling: il job evento può scrivere failure per primo, ma il polling usa lo snapshot ormai obsoleto e scrive subito dopo success, che diventa lo stato corrente dello stesso context. La nuova evidenza rispetto al commento precedente è che i nuovi trigger non chiudono questa finestra, perché questa riga li separa esplicitamente dal gruppo di concurrency del polling; occorre serializzare gli aggiornamenti o ricontrollare i finding prima di pubblicare il successo.

AGENTS.md reference: AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner 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: 9aa0d2349b

ℹ️ 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/codex-review-gate.mjs Outdated
Comment on lines +308 to +311
await setStatus(
repository,
headSha,
finding ? "failure" : "success",

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 Impedisci a un tentativo precedente di ripristinare success

Con due invocazioni @codex review sovrapposte sullo stesso HEAD, se il tentativo più recente pubblica un finding e quello precedente termina pulito dopo, questo ramo imposta success perché finding esamina soltanto la singola review ricevuta. Non consulta codexInvocations, le reazioni o lo status failure appena scritto, quindi può ribaltare un finding corrente; la nuova evidenza rispetto ai thread precedenti è il fast path pull_request_review* introdotto qui, che bypassa completamente la disambiguazione usata dal polling. Associa anche questi eventi al tentativo oppure impedisci a un esito pulito ambiguo di sovrascrivere un failure.

AGENTS.md reference: AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@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: 3c81299d37

ℹ️ 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 +6 to +9
pull_request_review:
types: [submitted]
pull_request_review_comment:
types: [created]

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 Mantieni un token scrivibile sugli eventi di review

Sulle PR provenienti da fork, i workflow pull_request_review e pull_request_review_comment ricevono normalmente un GITHUB_TOKEN in sola lettura anche se qui viene richiesto statuses: write. Quando Codex pubblica una review, il nuovo run cancella il polling pull_request_target tramite il gruppo condiviso, ma setStatus() fallisce con 403 e anche il fallback non può pubblicare error, lasciando codex-review fermo a pending; mantieni gli aggiornamenti dello status nel contesto fidato pull_request_target oppure evita che questi eventi cancellino quel polling.

Useful? React with 👍 / 👎.


concurrency:
group: codex-review-${{ github.event.pull_request.number || inputs.pull_request }}
group: codex-review-${{ github.event.pull_request.number || inputs.pull_request }}-${{ startsWith(github.event_name, 'pull_request_review') && (github.event.review.user.login || github.event.comment.user.login) != 'chatgpt-codex-connector[bot]' && github.run_id || 'gate' }}

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 Evita che segnali obsoleti cancellino il gate dell'HEAD corrente

Quando una review o un commento Codex relativo al vecchio SHA arriva dopo un evento synchronize, questo gruppo condiviso cancella il polling già avviato per il nuovo HEAD. Il run del segnale obsoleto poi termina senza riavviare il polling perché il commit della review non coincide con l'HEAD del payload, oppure opera soltanto sul vecchio SHA, quindi lo status del commit corrente resta indefinitamente pending; separa i segnali obsoleti per SHA oppure rileggi l'HEAD corrente e preserva il relativo polling.

AGENTS.md reference: AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

}
const statuses = await all(`/repos/${repository}/commits/${headSha}/statuses`);
const currentStatus = statuses.find((status) => status.context === "codex-review");
if (currentStatus && currentStatus.state !== "pending") return;

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 Consenti a un retry più recente di recuperare lo stesso SHA

Se un tentativo sullo stesso HEAD ha già prodotto failure o error — per esempio per un limite d'uso o per il timeout di cinque ore — una review pulita del retry entra qui con uno status diverso da pending e termina senza aggiornarlo. Poiché una nuova invocazione @codex review o le relative reazioni non attivano questo workflow, il gate non può più tornare verde sullo stesso SHA senza un dispatch manuale o un nuovo commit; accetta l'esito pulito quando può essere associato senza ambiguità a un tentativo successivo.

AGENTS.md reference: AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

@max23468

max23468 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: b1d9decce3

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

@max23468
max23468 merged commit e4723ec into main Aug 6, 2026
9 of 11 checks passed
@max23468
max23468 deleted the codex/codex-review-gate-clean branch August 6, 2026 14:58
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.

1 participant