Abstract
Autonomous coding agents frequently report passing test logs before opening pull requests, yet subsequent Git history rewrites, trailing commits, or uncommitted file edits decouple what passed from what reaches merge. Inspecting Koality-Assured/agent-factory at commit 5106dd2db and four public target repositories (core-harness-wiki#8, ai-harness-core#21, harness-cli#36, and koality-image-find#3–#4) confirmed role separation across skill specifications while identifying missing Python enforcement, a missing proof.schema.json schema, and an ancestry-only check in validate-merge that diverges from branch-tip equality.
Across 31 ephemeral Git repositories in Python, Go, and JavaScript (10 runs per scenario, 310 gate evaluations per arm), a naive status check (status == "PASS", exit_code == 0) accepted 22 of 28 invalid states (29.03% accuracy, 21.43% fail-closed, 78.57% false-accept). An ancestry-only check (git merge-base --is-ancestor) reached 74.19% accuracy (71.43% fail-closed, 28.57% false-accept), passing all three unverified trailing commits and two detached or dirty states. Enforcing exact HEAD == target_commit_sha alongside ancestry, clean tracked worktrees, distinct author and reviewer IDs, cross-model tags, and negative-routing flags achieved 100.00% accuracy (100.00% fail-closed, 0.00% false-accept; p50 104.0581 ms).
On 16 synthetic multi-language diffs, CamelCase-normalized boundary routing classified 100.00% (16/16) into direct versus full-assurance tiers at 0.0271 ms p50, whereas file-count heuristics under-escalated 62.50% (5/8) of security and concurrency diffs. Finally, controlled clean-slate trials on four single-file seeded-defect fixtures under Gemini 3.8 Flash (High) produced 4/4 BLOCK verdicts in both blind (15 findings) and author-primed (14 findings) arms, recording a 0.0% binary verdict delta while leaving multi-file anchoring and cross-model differences open.
Scope and questions
Thesis. Written verification rules in agent prompts cannot stop post-proof branch drift or self-certification unless deterministic gate code binds proof receipts to exact Git commit SHAs, clean worktrees, and independent reviewer records. Ancestry checks catch history rewrites but admit unverified trailing commits; closing both requires HEAD == target_commit_sha paired with git merge-base --is-ancestor.
This study answers four questions: how often status-only and ancestry-only gates fail open across Git mutations and tampered receipts; what accuracy and local latency a strict commit-bound gate achieves across Python, Go, and JavaScript; how accurately identifier-normalized diff screening routes direct versus full-assurance tiers; and whether removing persuasive author rationales alters catch rates on single-file seeded defects.
Contract audit and threat model
Koality-Assured/agent-factory separates read-only QA discovery (mara, elena, priya, owen, marcus) from worktree implementation (leo), replay/staging proof (kenji), blind security review (nadia), PR creation (simone), merge validation (julian), and human merge. These boundaries align with NIST AI RMF 1.0 (GOVERN 2.1, MEASURE 1.3, MANAGE 1.1), OWASP 2026 (ASI08:2026, ASI09:2026, LLM03:2026, LLM07:2026), MITRE CWE (CWE-367, CWE-354, CWE-250, CWE-862), and A2A Opaque Execution.
Auditing public PR receipts identified three live gaps: agent-factory lacked a JSON Schema for proof.json and Python --is-ancestor validators; ai-harness-core#21 and harness-cli#36 logged --is-ancestor main HEAD instead of <target_commit_sha> HEAD; and GitHub squash merges mint new commits on main whose parents point to prior main tips rather than PR head SHAs, making pre-merge branch checks and commit trailers essential.
Gate architecture and candidate schema
The proposed candidate proof.schema.json pairs core staging-prove fields (run_id, canonical 40-char lowercase hex target_commit_sha, status, proof_mode, replay_command, exit_code, timezone-aware verified_at) with attestation and tier fields (author_id != reviewer_id, distinct author_model_family and reviewer_model_family, tier, and negative_route_checked: true).
Before PR creation and before merge, verify_strict_commit_bound verifies integer exit_code == 0 (rejecting boolean confusion), git cat-file -t == "commit", git merge-base --is-ancestor exit 0, exact HEAD == target_commit_sha, branch-pointer parity when specified, and clean tracked worktrees via git status --porcelain --untracked-files=no.
Measured results
| Gate arm | Accuracy | Fail-closed rate | False-accept rate | p50 latency | p95 latency |
|---|---|---|---|---|---|
naive_status_only | 29.03% | 21.43% | 78.57% | 0.1692 ms | 0.8606 ms |
ancestry_only | 74.19% | 71.43% | 28.57% | 81.6019 ms | 91.9437 ms |
strict_commit_bound | 100.00% | 100.00% | 0.00% | 104.0581 ms | 115.5478 ms |
ancestry_only failed open on 8/28 negative scenarios: all 3/3 unverified trailing commits (Python, Go, JavaScript), 2/4 detached-HEAD or dirty-worktree states, and 3/15 self-signed or unrouted receipts. Enforcing strict commit binding closed all 28 invalid states with 0 false rejects at 22.46 ms median overhead over ancestry-only checking.
| Classifier | Correct | Over-escalation | Under-escalation | p50 latency |
|---|---|---|---|---|
always_full_assurance | 8/16 (50.00%) | 100.00% (8/8) | 0.00% (0/8) | 0.0005 ms |
naive_file_count | 7/16 (43.75%) | 50.00% (4/8) | 62.50% (5/8) | 0.0006 ms |
deterministic_boundary | 16/16 (100.00%) | 0.00% (0/8) | 0.00% (0/8) | 0.0271 ms |
Blind versus author-primed trials
Four standalone multi-language fixtures seeded reproducible defects alongside passing happy-path unit tests: a Go RLock/Lock lease race (CWE-362), a Python ancestry-only gate bypass (CWE-345), a Node.js missing-separator path escape (CWE-22), and a Python fail-open exception swallow (CWE-636).
Clean-slate Gemini 3.8 Flash (High) reviewers evaluated paired blind (diff + spec) and non_blind (diff + spec + persuasive author notes) packets. Both arms returned 4/4 BLOCK verdicts (100.0% catch rate, 0.0% binary verdict delta), with 15 total findings in the blind arm versus 14 in the non-blind arm (which missed a medium same-owner/TTL edge case). Under clean-slate isolation with explicit specifications on single-file diffs, persuasive author notes did not produce false passes.
Threats and limitations
- All 31 Git tests ran in ephemeral single-package repositories; deep monorepo histories will exhibit different
gitsubprocess latencies. - Latencies were recorded on Windows 10 AMD64 (Git 2.49.0, Python 3.11.9) and are not cross-host guarantees.
- Deterministic routing relies on path classes and sub-tokenized diff patterns rather than full AST or call-graph analysis.
- The blind-review trial covered
N=4single-file fixtures on one model family (Gemini 3.8 Flash (High)); multi-file author anchoring and cross-model (ClaudevsGemini) effects remain unresolved. - Token spend and wall-clock differences between live
directandfull-assuranceagent sweeps were not measured.
Conclusion and reproduction
Deterministic verification tooling must bind receipts to exact HEAD commits, clean worktrees, and separate reviewer records before PR creation and before squash merge, rather than trusting status strings or ancestry alone. Reproduce all tests and metrics offline from the white-paper package:
python supporting/benchmark/verify_sha256_manifest.py
python -m unittest discover -s supporting/benchmark -p "test_*.py" -v
python supporting/benchmark/run_benchmark.py --iterations 10 --out /tmp/proof-gate-repro
The claim-to-evidence ledger, source log, reproduction guide, and Mermaid architecture diagrams keep every measured figure, primary source, and unresolved boundary explicit.