Skip to content

harness: verify Layer 2 (tests against base code, Codex judge, gate) - #67

Open
yogex wants to merge 9 commits into
masterfrom
claudex-verify-layer2
Open

yogex wants to merge 9 commits into
masterfrom
claudex-verify-layer2

Conversation

@yogex

@yogex yogex commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Stacks on #64 and targets master so CI runs (the workflow only runs on PRs into master). The diff therefore includes #64's 4 commits; Layer 2 is the last 3 (659064d, 58b4c08, 24fab0b). Merge #64 first. All changes are under orchestrator-sim-claudex/harness/; the app and its project config are untouched. Design: Benskill project doc claudex-verify-layer2-design.md.

Layer 1 checks that the reviewer's cited tests exist. Layer 2 checks that each cited test actually exercises its acceptance criterion. A model is only used where running the test can't decide.

verdict → verify-claims (L1) → verify-base (2a) → judge-pack → verify-judge (2b) → verify-gate → push

2a, verify-base.sh (no model). Runs each cited test against the code before the change: a scratch worktree at the merge base, with changed test files and test config copied from the head. A test that fails there twice depends on the change. Passing, flaky, mixed or unrunnable results stay open for 2b. Per-test results come from JUnit XML. New config: verify.base_setup, verify.runners[] ({glob, run} with {file}, {name}, {junit}), verify.budget_minutes.

2b, verify-judge (Codex gpt-6.2-astra, high). Judges only what 2a left open, from an inlined pack built by judge-pack.sh. Every verdict must quote a line from the pack; the gate discards verdicts whose quote isn't there. It isn't a loop node, because Archon ignores effort on loop nodes.

Gate, verify-gate.sh. The only step that sets the handoff, and it can only lower it. Draft on: L1 contradicted, 2a or 2b couldn't run, 2b contradicted with a real quote. Stop if HEAD or the working tree changed while 2b ran: Archon runs Codex nodes with full access and ignores allowed_tools, so this is the guard. The PR body gets a table: claim × L1 / 2a / 2b.

Security fixes found while testing.

  • Test names come from model output and go into test commands. The first version shell-escaped them, but bash ${var//x/y} strips backslashes in the replacement, so the escaping was undone. Values now never enter the command text: placeholders become "$VB_FILE" / "$VB_NAME" / "$VB_JUNIT" and values go in the environment. A self-test names a test $(touch …) and checks nothing ran.
  • The judge's output is read from Archon's outcomes file and the gate's output from a saved file, never substituted into a shell script.

Metrics. metrics.py reports 2a outcomes, judge calls, drafts caused by the judge, and (--decisions) your owner:accept / owner:rework label on them, per feature and --weekly. That's the evidence for keeping 2b on every PR or cutting it back to HARDEN.

Checks. selftest.sh: 87 passed, 0 failed (20 new; 2a cases run real node:test tests). Mutation checks: removing the quote check or the tree check makes their tests fail. Both tiers render; every depends_on and $node.output reference resolves. product-grep.sh clean.

Not run. A real ship run with Archon and Codex; Vitest or Playwright through 2a (the template's runner commands use the documented JUnit options, unexercised here); the seeded-bug PRs.

Before using it on a project. Add verify and models.verify to the project's config (the harness template has examples), and set owner.

https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5


Generated by Claude Code

verify-claims.sh checks the reviewer's claims against the reviewed head with
no model: every "met" criterion must cite files that exist, quoted test names
must be in the cited test files, and every test edit must have a ruling.

A new verify node in ship.yaml can only lower the handoff: ready becomes draft
on any contradicted claim or when the check can't run. Drafts in either tier
open as draft PRs, skip the merge gate and record pr-draft. Non-verified
claims are listed in the PR body.

Also closes a gap in the verdict node: a test edit with no ruling used to pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
…guard

A draft PR now waits for an owner label instead of a chat answer, because
Archon records but does not check who answers a wait, and GitHub records who
added a label.

- forge.sh owner-decision: owner:accept / owner:rework count only if GitHub's
  label events show the configured owner added them; fails closed (exit 4).
- forge.sh pr-label; the ship workflow labels draft PRs needs-owner and
  clears it when a re-ship is no longer a draft.
- feature.sh start refuses (exit 5) to stack on a pr-draft feature until the
  owner accepts it, and nudges.
- nudge.sh: one-way ntfy notice any orchestrator can send; never fails the
  run and never carries a decision.
- Config field owner; CONTRACTS.md sections and orchestrator duties.
- 13 new self-test cases (64 pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
The owner doesn't want another app, so nudge.sh now defaults to a PR comment
that @mentions the config owner. ntfy stays as CLAUDEX_NUDGE=ntfy. A title is
sent once per PR so retries don't spam. GitHub doesn't notify you of your own
comments, so this needs gh logged in as a bot or app account; the script says
so when it isn't.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
Drop the owner line from project/claudex.json: this PR changes the harness,
not the app's project config. A project sets "owner" itself; until it does,
forge.sh owner-decision fails closed ("config has no owner").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
verify-base.sh runs each test the reviewer cited for a "met" criterion (only
those Layer 1 verified) in a scratch worktree at the merge base, with the
changed test files and test config copied from the head. A test that fails
there twice depends on the change (verified). One that passes, fails only
once, gives mixed results, or can't run stays open for the 2b judge.

- Per-test results come from JUnit XML, so "failed" and "couldn't run" are
  different. Runners are configured per glob (verify.runners), with
  verify.base_setup and a per-PR budget.
- Test names come from model output. They never enter command text: the
  runner template gets "$VB_FILE" / "$VB_NAME" / "$VB_JUNIT" references and
  the values go in the environment. Bash ${var//x/y} strips backslashes from
  the replacement, so the first, escaping-based version was injectable; the
  self-test now has a test named $(touch ...) and checks nothing ran.
- Config examples in the harness template (Vitest, Playwright) and a real
  node:test runner in the fixture. models.verify added (gpt-6.2-astra, high).
- 9 self-test cases using real node:test runs (76 pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
ship.yaml now runs verify-claims (L1) -> verify-base (2a) -> judge-pack ->
verify-judge (2b) -> verify-gate. The gate (verify-gate.sh) is the only step
that sets the handoff after the review and can only lower it.

- verify-judge: Codex, model and effort from models.verify (render.sh
  placeholders VERIFY_MODEL / VERIFY_EFFORT; gpt-6.2-astra, high). Not a
  loop node, because Archon ignores effort on loop nodes. It runs only for
  claims 2a left open, on an inlined pack (judge-pack.sh: criterion,
  evidence, 2a log tail, cited test, its local imports, app diff).
- Every judge verdict must quote a line from the pack; the gate checks it
  and turns a verdict with a missing quote into unverified.
- Archon runs Codex nodes with full access and ignores allowed_tools. The
  gate compares HEAD and a hash of `git status --porcelain` from before the
  judge ran; any change stops the run (nothing pushed) and nudges the owner.
- Draft on: L1 contradicted, 2a or 2b couldn't run, 2b contradicted with a
  valid quote. The judge's output is read from the outcomes file, never
  substituted into a shell script; the PR step reads the gate's saved JSON.
- PR body gets one table: claim x L1 / 2a / 2b with the judge's quote.
- 10 self-test cases (86 pass); mutation checks on the quote and tree guards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
- metrics.py: per-feature "verify" block (2a outcomes by reason, judge
  calls, drafts by the verifier and by the 2b judge, stops), --weekly per
  ISO week, and --decisions to look up the owner's label on PRs the judge
  turned into drafts. That measures whether 2b should keep running on every
  PR. The verify-base node now outputs counts by reason for it.
- CONTRACTS.md: Verifier section rewritten for L1, 2a, 2b and the gate;
  config table gains verify and models.verify.
- README: verifier scripts; needs git, jq, python3 and node.
- 1 self-test case with a fake Archon database (87 pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efoispwN9Zyq8nNE9rds5
@yogex
yogex changed the base branch from claudex-verify-layer1 to master December 3, 2026 08:00
- README: master's template and spec.sh lines plus this branch's
  verifier, owner-decision and nudge entries.
- ship.yaml pr node: this branch's verify handoff plus master's
  feature variable for the spec.sh line.
- selftest.sh: keep both test blocks. One fake gh api arm: guard tests
  (FAKE_ISSUE set) get JSON, owner-decision tests get event lines. The
  two arms clashed silently and broke the guard tests.
- ship.yaml push and checkpoint-harden: assign draft_reason before
  quoting it (Archon warned on the quoted substitution).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efois1hjx9JeuGhxWixrm
Conflicts:
- README: master's template and spec.sh lines plus Layer 2's verifier list.
- ship.yaml: #64's assign-then-quote fixes, renamed to verify-gate; the
  pr node keeps master's feature variable for the spec.sh line.
- fixture and template claudex.json: keep both the verify and guard blocks.
- selftest.sh: keep both test blocks.

Also:
- render.sh fails when the config leaves any template value unset. The
  project config has no models.verify, so ship rendered 'model: null'
  and Archon rejected both ship workflows. It now stops with the missing
  keys. The project adds models.verify itself (the template has defaults).
- ship.yaml verify-gate: assign the handoff before quoting it.
- selftest: two render tests (102 pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016efois1hjx9JeuGhxWixrm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants