From d7795422dc5984b5042a4a0c27f0d10a5306257c Mon Sep 17 00:00:00 2001 From: Jonathan Zhang Date: Tue, 21 Jul 2026 14:50:34 -0700 Subject: [PATCH] ci(codex-review): log the model + CLI version each review actually used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The reusable installs `@openai/codex@latest` on every run, so the default model floats silently — an upstream swap would change review behavior with no signal in the audit trail. Capture the CLI version (always, the reliable drift signal) and the model from Codex's startup banner (best-effort, pipefail-safe with an "(unreported)" fallback), and surface both in the job summary and as a footer on the posted PR review comment. No behavior change to the review itself; new code runs only on the existing should_run happy path and cannot trip pipefail (grep/sed guarded with `|| true`). Verified: actionlint clean; codex review --uncommitted clean over two consecutive rounds. Auto-Merge-Risk: standard Co-Authored-By: Claude Opus 4.8 --- .github/workflows/codex-review.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/codex-review.yml b/.github/workflows/codex-review.yml index 6f99390..b18c99f 100644 --- a/.github/workflows/codex-review.yml +++ b/.github/workflows/codex-review.yml @@ -177,6 +177,26 @@ jobs: fi echo "$verdict" | head -c 4096 > /tmp/codex.verdict + # Record which Codex model + CLI version actually ran. `npm install + # -g @openai/codex@latest` (above) floats the CLI — and thus its + # default model — on every run, so a silently shifted default would + # otherwise drift unnoticed across the fleet. The CLI version is the + # reliable signal (always captured); the model is best-effort from + # Codex's startup banner, falling back to "(unreported)". grep/sed + # guarded with `|| true` so a missing banner never trips pipefail. + codex_version=$(codex --version 2>/dev/null | head -n1 || true) + model=$(grep -ioE 'model:[[:space:]]*[A-Za-z0-9._-]+' /tmp/codex.out \ + | head -n1 | sed -E 's/^[Mm]odel:[[:space:]]*//' || true) + [ -n "$model" ] || model="(unreported — see logs)" + printf '%s' "$model" > /tmp/codex.model + printf '%s' "${codex_version:-unknown}" > /tmp/codex.cliversion + { + echo "### Codex review provenance" + echo "- CLI: \`${codex_version:-unknown}\`" + echo "- Model: \`${model}\`" + echo "- Reasoning effort: \`low\`" + } >> "$GITHUB_STEP_SUMMARY" + - name: Post review comment if: steps.gate.outputs.should_run == 'true' env: @@ -187,5 +207,7 @@ jobs: echo "### Codex review" echo cat /tmp/codex.verdict + echo + echo "Model: \`$(cat /tmp/codex.model 2>/dev/null || echo unknown)\` · CLI: \`$(cat /tmp/codex.cliversion 2>/dev/null || echo unknown)\` · reasoning: \`low\`" } > /tmp/comment.md gh pr comment "$PR" --body-file /tmp/comment.md