Commit quality and Codex hook approval
The project Codex hook is defined in .codex/hooks.json. Open Codex in this
repository and use /hooks to review and trust the definition. The installer
does not approve it. If this task is attached to a different folder, open the
actual eval-dashboards project root to review its project hook.
The PreToolUse hook checks direct Git commits before execution. The Lefthook
pre-commit hook checks the same evidence for ordinary Git commits outside
Codex. Install Git hooks with pnpm exec lefthook install after cloning.
Workflow
- Finish the change and stage the intended files. Keep unrelated work separate; this gate rejects unstaged tracked files and untracked files, because tests against those files would not prove the staged commit works.
- Run
node scripts/commit-evidence.mjs snapshotand retain thetreeandhead. - Review that staged diff for correctness, regressions, and unsupported claims. Resolve findings and repeat the review when the staged content changes.
- Run
pnpm quality:record. It executespnpm check,pnpm schema:check,pnpm verify:cli,pnpm verify:package,pnpm assets:verify, andpnpm audit:ci. Exact outputs and exit statuses are stored beneath the worktree’s Git directory inquality-evidence/. - Write a JSON review record outside the working tree (for example in
/tmp), then runpnpm quality:review /absolute/path/review.json. - Run
pnpm quality:verify, then use a standalonegit commit -m "...".
The installed-package check uses --engine-strict; required CI also runs its
consumer on Node 20/22/24/26. Keep the development suite on Node 22 and restore
that runtime before the remaining checks. See runtime compatibility.
Review record shape (replace the example values with the actual review):
{
"tree": "the tree returned by snapshot",
"head": "the HEAD returned by snapshot, or null for a new repository",
"reviewer": "the person or agent that performed the review",
"verdict": "pass",
"findings": [],
"claims": [
{
"claim": "Describe a behavior actually checked",
"evidence": [{ "path": "test/relevant.test.ts", "line": 1 }]
}
]
}
Findings, when present, must have status: "resolved"; include their description
and resolution. Citations must resolve to lines in staged files. Put exact
verification commands, results, limitations, and any required raw CI log review
in a durable report under docs/reviews/. External adoption still requires an
external commit/PR link before marking it complete.
The Codex guard also accepts a single static JSON tools.exec_command call,
optionally inside text(await ...). The literal command and absolute workdir
are checked against this repository and its staged evidence. Dynamic JavaScript,
extra statements, shell overrides, and unknown arguments are rejected for this
form; the wrapper is parsed without evaluating JavaScript.
For tool bridges that omit working-directory metadata, a single standalone
Git command may use -C with a quoted literal absolute directory before the
commit subcommand. The hook resolves that directory and requires it to match
this repository; relative paths, substitutions, extra flags, and compound
commands remain rejected.
Guarantees and limits
Changing staged content or HEAD invalidates prior evidence. A failed rerun invalidates the prior successful check record. Altered check logs are rejected. The gate does not stage files, commit changes, grant hook trust, run an AI review, or claim that a citation proves its associated assertion. Review quality remains the reviewer’s responsibility; the JSON is a recorded attestation.
These are local development safeguards, not tamper-proof enforcement. Codex hooks are skipped until trusted, and hook runtime failures can fail open. Git hooks can be bypassed or uninstalled by a local user. CI and protected-branch requirements remain necessary for organization-wide enforcement. The Codex guard rejects common bypass flags and compound commit commands; it is not a general shell interpreter or a security boundary against arbitrary scripts.
Official hook format and trust behavior: https://learn.chatgpt.com/docs/hooks.
Required merge checks and PR descriptions
The PR description uses .github/pull_request_template.md. CI reads its headings
and requires a populated section for each one. This is a structure check: authors
and reviewers still need to judge plain English, examples, and actual evidence.
Renovate uses the same layout, and CodeRabbit keeps its summary in review comments.
The owner-authorized policy for main is recorded in
.github/main-branch-protection.json: GitHub Actions must provide lint-title,
lint-description, lint-and-test (22.x), examples (22.x), and composite-action.
The PR must be up to date and review conversations resolved. These restrictions
include administrators. The policy requires a PR but adds no minimum human
approval count; do not bypass an outstanding change request or actionable comment.
No paid review service is required to satisfy the check list.
A maintainer can inspect the actual remote settings without changing them:
gh api repos/IcodeNet/eval-dashboards/branches/main/protection
Treat the JSON file as the reviewed expected policy, not as proof that GitHub is configured. Compare it with the API response when changing checks or repository settings. Keep check names and required-check settings in sync; a required check that never runs blocks merging. Changing a PR description reruns its validation. Release/deployment authorization remains separate from merge authorization.