Rainer Gerhards 0ff5792ee4 codex: wire local container testing hook into agent workflow
Why:
Mandate the local container testing validation per AGENTS.md before push.
To make it completely robust, we prevent empty or invalid marker commits
from bypassing the check, expand the file types that trigger re-run
(including Python, Dockerfile, YAML metadata, and tests), and handle git
history changes gracefully without crashes.

Impact:
Developer/AI agents are blocked from pushing if they touch C, Python, Docker,
YAML, or test files without running container validation first.

Before/After:
Before, container validation wasn't wired, or empty/invalid markers could
be bypassed or cause shell crashes. Now, the hook is fully integrated, robust
against invalid commit hashes, and covers all relevant file extensions.

Technical Overview:
1. Wire pre_push_container_gate.sh into hooks.json under PreToolUse for Bash.
2. Use git rev-parse to verify the validation marker commit hash actually
   exists in the local repository before running diffs.
3. Expand file matching regex to include .py, Dockerfile,
   MODULE_METADATA.yaml, and any files under tests/.
4. Gitignore .codex/container_validated.marker to keep mutable local developer
   state out of commits.

With the help of AI-Agents: Antigravity
2026-05-23 15:52:22 +02:00
..

Codex Repo Setup

This repository ships a repo-local Codex hook configuration for trusted projects.

What it does

  • Enables Codex hooks for this repository via .codex/config.toml
  • Runs .codex/pre_commit_format_gate.sh before Bash-based git commit commands
  • Understands both direct git commit ... invocations and shell-wrapped forms such as bash -lc 'git commit ...'
  • Runs the deterministic repo-policy focus checks first against the staged commit snapshot
  • If those invariants fail, the hook exits early and prints the specific failures for the agent to fix
  • The hook runs ./devtools/format-code.sh --git-changed
  • If clang-format-18 is not installed, the hook allows the commit without blocking
  • If no tracked .c or .h files have changed, the hook skips formatting work
  • If formatting fails, the git commit tool call is blocked and Codex is told to fix formatting first
  • If formatting updates .c or .h files, the hook stages those tracked formatter updates automatically and then allows the commit
  • If partially staged .c or .h files are present, the hook blocks because auto-restaging would not be safe

Requirements

  • The repository must be trusted so Codex loads .codex/config.toml
  • Codex hooks must be available in your Codex build

Scope

This affects Codex users working in this repository. It does not replace normal project review or CI checks, and it does not affect contributors who are not using Codex.