When an autonomous coding agent finishes a patch, runs tests, and writes "status": "PASS" into a build log, that receipt tells you what passed at one point in time. It does not prove that the code sitting at HEAD when a pull request opens, or right before a human hits squash-merge, is the same commit the verifier tested.
Any ordinary Git operation between test completion and merge breaks an unbound receipt. Running git commit --amend, rebasing onto main, cherry-picking onto a release branch, stacking one quick post-review commit on top, or leaving uncommitted edits in the working tree changes the executable bytes while leaving a JSON "PASS" summary untouched.
The loophole hidden inside git merge-base --is-ancestor
During a public audit of Koality-Assured/agent-factory (commit 5106dd2db) and four downstream target repositories (core-harness-wiki#8, ai-harness-core#21, harness-cli#36, and koality-image-find#3–#4), two patterns stood out. First, agent-factory specified exact branch-tip matching (target_commit_sha == branch_tip) for PR creation, yet its merge-validation skill specified git merge-base --is-ancestor <target_commit_sha> <branch_tip> alone and had no proof.schema.json or Python validator in scripts/. Second, two live PR summaries recorded --is-ancestor main HEAD, which checks branch freshness against main rather than verifying the tested commit SHA.
An ancestry check catches history rewrites (--amend, rebase, cherry-pick) because those commands mint unreachable commit objects. It fails open, however, when someone stacks a new unverified commit C2 on top of the tested commit C1:
Verified commit: C1 <-- proof.json ("target_commit_sha": C1, "status": "PASS")
|
Unverified edit: C2 <-- HEAD (adds bypass or review fix without re-running Kenji)
git merge-base --is-ancestor C1 C2 -> exit 0 (C1 is an ancestor of C2)
HEAD == target_commit_sha -> FAIL (C2 != C1)
Across 31 offline synthetic Git repositories spanning Python, Go, and JavaScript (10 runs per scenario, 310 evaluations per arm), that gap drove the difference between failing open and failing closed:
naive_status_only: 29.03% overall accuracy, 21.43% fail-closed rate, 78.57% false-accept rate (0.1692 ms p50).ancestry_only: 74.19% overall accuracy, 71.43% fail-closed rate, 28.57% false-accept rate (81.6019 ms p50), failing open on all3/3trailing commits,2/4detached or dirty states, and3/15self-signed or unrouted receipts.strict_commit_bound: 100.00% accuracy, 100.00% fail-closed rate, 0.00% false-accept rate (104.0581 ms p50) by enforcingHEAD == target_commit_sha, ancestry, clean tracked worktrees,author_id != reviewer_id, cross-model tags, and negative-routing flags.
Why file-count routing under-escalates security fixes
Running an 11-agent sweep on a markdown typo wastes context and time, yet simple heuristics cut corners in the wrong places. Across 16 synthetic multi-language diffs (8 safe direct diffs and 8 high-risk full-assurance diffs):
- Defaulting everything to
full-assurancescored 50.00% accuracy (100.00% over-escalation). - Routing
<= 1changed file todirectscored 43.75% (7/16), over-escalating 50.00% (4/8) of two-file diffs (three code-plus-test fixes and one two-file documentation typo edit) while under-escalating 62.50% (5/8) of single-file changes touching JWT checks, Go lease mutexes, path sanitization, API endpoints, and JSON Schemas. - Normalizing CamelCase and
snake_caseidentifiers (soRequirePermissionsplits intoRequire Permissioninstead of hiding from word-boundary regex) before screening security, concurrency, schema, and cross-module boundaries reached 100.00% (16/16) with 0.00% under-escalation at 0.0271 ms p50.
What our controlled blind-review trial actually showed
Removing an author's self-justifying explanation before security review is a core principle of clean-slate verification. To test it empirically, we built four multi-language seeded-defect diffs (a Go RLock/Lock lease race CWE-362, a Python ancestry-only gate bypass CWE-345, a Node.js missing-separator directory escape CWE-22, and a Python except Exception: return True fail-open handler CWE-636) and confirmed every seeded defect failed its reproduction test.
We then dispatched paired blind (diff + spec only) and non_blind (diff + spec + persuasive author rationale) packets to clean-slate Gemini 3.8 Flash (High) reviewer subagents:
- Arm B (
blind):4/4BLOCKverdicts (100.0% critical seeded-defect catch rate), 15 total findings (5 critical, 1 high, 7 medium, 2 low). - Arm A (
non_blind):4/4BLOCKverdicts (100.0% critical seeded-defect catch rate), 14 total findings (5 critical, 2 high, 6 medium, 1 low).
The binary verdict delta was 0.0%. On narrow single-file diffs evaluated in clean-slate context against explicit specifications, persuasive author notes did not fool the reviewer into approving any seeded defect, though the blind pass caught one extra medium edge case on same-owner lease re-acquisition and ttl <= 0. Larger multi-file PRs and secondary model families remain open to test.
Three rules for autonomous promotion pipelines
- Bind verification receipts to exact Git commits, not branch names or
"PASS"text: EnforceHEAD == target_commit_sha,git merge-base --is-ancestor, and a clean tracked worktree in deterministic gate code before PR creation and again before merge. - Validate proofs on the PR branch before squash merge: GitHub squash merges mint a new commit on
mainwhose parent is the previousmaintip; preserve post-merge provenance with standardizedX-Factory-RunandX-Factory-Ledger-IDcommit trailers. - Never route execution tiers by changed-file count: Screen normalized identifiers for auth, concurrency, schema, and public-API boundaries, and dispatch reviewers clean-slate with explicit invariant specs rather than chat transcripts.