Close-report gates accept unverified claims — tighten gates 1, 2, 4 and read criteria #206

Closed
opened 2026-10-15 02:59:20 +00:00 by ben · 3 comments
Owner

Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against main at 3e50274.

Symptom (verified, close-report-lib.sh)

  • Gate 1 (:99-120) checks each SHA is reachable from gate_head, NOT that it is new since the run's start_sha, authored by the worker identity, or cites #<issue> — any pre-existing main SHA passes.
  • Gate 2 (:122-135) checks changed_files ⊆ diff, not diff ⊆ changed_files; unlisted touched files are never flagged.
  • Gate 3 (:138-140): any non-empty no_code_change string permits success with zero commits.
  • Gate 4 (:143-159) trusts self-reported tests[].exit_code; nothing is re-run. "QA agent approved everything even when tests didn't run" is the exact failure mode in the Oct 2026 r/ClaudeCode thread.
  • criteria is never read.
  • In pr mode, landing_sweep_orphans (landing-lib.sh:375-402) and landing_merge_reconcile (:327-334) merge ANY green agent/issue-N PR whether or not close-report ever ran.

Proposed change

  • Gate 1: require start_sha..gate_head membership (run-swarm passes start_sha via the host-signals dir) and #<issue> in the subject.
  • Gate 2: bidirectional set equality (report extra files as violations).
  • Gate 4: re-execute the repo's pinned test command host-side (new policy key TEST_CMD in swarm-policy.sh, default = the CLAUDE.md loop) and compare; refuse on mismatch.
  • Gate 5b: every acceptance clause in the issue body has a criteria entry (presence, not truth).
  • pr mode: landing_merge_if_green requires a close-report: gates passed marker comment (body-marker-lib) on the PR before merging.

Acceptance

  • tests/close-report-lib-test.sh: foreign SHA refused; unlisted file refused; self-reported pass with a failing re-run refused; missing criteria refused.
  • tests/landing-lib-test.sh: green PR without the marker is not merged by the sweep.
_Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against `main` at 3e50274._ ## Symptom (verified, `close-report-lib.sh`) - Gate 1 (:99-120) checks each SHA is reachable from `gate_head`, NOT that it is new since the run's `start_sha`, authored by the worker identity, or cites `#<issue>` — any pre-existing main SHA passes. - Gate 2 (:122-135) checks `changed_files ⊆ diff`, not `diff ⊆ changed_files`; unlisted touched files are never flagged. - Gate 3 (:138-140): any non-empty `no_code_change` string permits success with zero commits. - Gate 4 (:143-159) trusts self-reported `tests[].exit_code`; nothing is re-run. "QA agent approved everything even when tests didn't run" is the exact failure mode in the Oct 2026 r/ClaudeCode thread. - `criteria` is never read. - In pr mode, `landing_sweep_orphans` (`landing-lib.sh:375-402`) and `landing_merge_reconcile` (:327-334) merge ANY green `agent/issue-N` PR whether or not close-report ever ran. ## Proposed change - Gate 1: require `start_sha..gate_head` membership (run-swarm passes `start_sha` via the host-signals dir) and `#<issue>` in the subject. - Gate 2: bidirectional set equality (report extra files as violations). - Gate 4: re-execute the repo's pinned test command host-side (new policy key `TEST_CMD` in `swarm-policy.sh`, default = the CLAUDE.md loop) and compare; refuse on mismatch. - Gate 5b: every acceptance clause in the issue body has a `criteria` entry (presence, not truth). - pr mode: `landing_merge_if_green` requires a `close-report: gates passed` marker comment (body-marker-lib) on the PR before merging. ## Acceptance - `tests/close-report-lib-test.sh`: foreign SHA refused; unlisted file refused; self-reported pass with a failing re-run refused; missing criteria refused. - `tests/landing-lib-test.sh`: green PR without the marker is not merged by the sweep.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

  • Ruling: ready-for-agent.
  • Why this is a two-way door: strengthening the deterministic close-report gates and requiring a merge-marker are tightenings; revertible by a commit. The one new closed-vocabulary policy key (TEST_CMD) follows the bump-pin-then-declare order (GOTCHAS 17) and defaults to the CLAUDE.md offline loop — a known discipline, not a human door.
  • What proves it: tests/close-report-lib-test.sh and tests/landing-lib-test.sh — a foreign SHA refused, an unlisted touched file refused, a self-reported pass that fails on host re-run refused, a missing-criteria envelope refused, and a green PR without the gates-passed marker left unmerged.

Agent Brief

Category: bug

Summary: The deterministic close-report gates let unverified claims through: gate 1 accepts any already-landed SHA, gate 2 is one-directional, gate 4 trusts self-reported test exit codes, criteria is never read, and pr-mode sweeps merge green agent PRs that never ran a close-report. Tighten the gates and require a merge marker.

Current behavior: Gate 1 only checks reachability from the landing head; gate 2 only checks changed_files ⊆ diff; gate 4 believes tests[].exit_code without re-running; criteria is ignored; the orphan-sweep/reconcile paths merge any green agent/issue-N PR regardless of whether gates ever passed.

Desired behavior:

  • Gate 1: require each commit to be within start_sha..gate_head (run-swarm passes start_sha via the host-signals dir) and the subject to cite #<issue>.
  • Gate 2: bidirectional set equality — an unlisted touched file is a violation.
  • Gate 4: re-execute the repo's pinned test command host-side (new policy key TEST_CMD, default = the CLAUDE.md offline loop) and compare against the self-report; refuse on mismatch.
  • Gate 5b: every acceptance clause in the issue body has a criteria entry (presence, not truth).
  • pr mode: the merge-if-green path requires a close-report: gates passed marker comment on the PR before merging.

Key interfaces: A close-report validator that derives commit membership from a run-provided start ref and the landing head, enforces set-equality both ways on changed files, re-runs the repo's pinned test command and refuses on disagreement, asserts a criteria entry per issue-body acceptance clause, and a merge path that refuses to merge a green agent PR lacking a gates-passed marker. TEST_CMD is a closed-vocabulary policy key (GOTCHAS 17 rollout order; default the CLAUDE.md loop).

Acceptance criteria:

  • tests/close-report-lib-test.sh: a foreign/pre-existing SHA is refused; an unlisted touched file is refused; a self-reported pass whose host re-run fails is refused; a missing-criteria envelope is refused.
  • tests/landing-lib-test.sh: a green PR without the gates-passed marker is not merged by the sweep.
  • Offline suite green; TEST_CMD defaults correctly when unset.

Out of scope: Gates 6-9 (binds/mirrors/suites/cross-repo), already implemented; redesigning pr-mode merge authority beyond the marker requirement.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** - **Ruling:** `ready-for-agent`. - **Why this is a two-way door:** strengthening the deterministic close-report gates and requiring a merge-marker are *tightenings*; revertible by a commit. The one new closed-vocabulary policy key (`TEST_CMD`) follows the bump-pin-then-declare order (GOTCHAS 17) and defaults to the CLAUDE.md offline loop — a known discipline, not a human door. - **What proves it:** `tests/close-report-lib-test.sh` and `tests/landing-lib-test.sh` — a foreign SHA refused, an unlisted touched file refused, a self-reported pass that fails on host re-run refused, a missing-`criteria` envelope refused, and a green PR without the gates-passed marker left unmerged. ## Agent Brief **Category:** bug **Summary:** The deterministic close-report gates let unverified claims through: gate 1 accepts any already-landed SHA, gate 2 is one-directional, gate 4 trusts self-reported test exit codes, `criteria` is never read, and pr-mode sweeps merge green agent PRs that never ran a close-report. Tighten the gates and require a merge marker. **Current behavior:** Gate 1 only checks reachability from the landing head; gate 2 only checks `changed_files ⊆ diff`; gate 4 believes `tests[].exit_code` without re-running; `criteria` is ignored; the orphan-sweep/reconcile paths merge any green `agent/issue-N` PR regardless of whether gates ever passed. **Desired behavior:** - Gate 1: require each commit to be within `start_sha..gate_head` (run-swarm passes `start_sha` via the host-signals dir) and the subject to cite `#<issue>`. - Gate 2: bidirectional set equality — an unlisted touched file is a violation. - Gate 4: re-execute the repo's pinned test command host-side (new policy key `TEST_CMD`, default = the CLAUDE.md offline loop) and compare against the self-report; refuse on mismatch. - Gate 5b: every acceptance clause in the issue body has a `criteria` entry (presence, not truth). - pr mode: the merge-if-green path requires a `close-report: gates passed` marker comment on the PR before merging. **Key interfaces:** A close-report validator that derives commit membership from a run-provided start ref and the landing head, enforces set-equality both ways on changed files, re-runs the repo's pinned test command and refuses on disagreement, asserts a `criteria` entry per issue-body acceptance clause, and a merge path that refuses to merge a green agent PR lacking a gates-passed marker. `TEST_CMD` is a closed-vocabulary policy key (GOTCHAS 17 rollout order; default the CLAUDE.md loop). **Acceptance criteria:** - [ ] `tests/close-report-lib-test.sh`: a foreign/pre-existing SHA is refused; an unlisted touched file is refused; a self-reported pass whose host re-run fails is refused; a missing-`criteria` envelope is refused. - [ ] `tests/landing-lib-test.sh`: a green PR without the gates-passed marker is not merged by the sweep. - [ ] Offline suite green; `TEST_CMD` defaults correctly when unset. **Out of scope:** Gates 6-9 (binds/mirrors/suites/cross-repo), already implemented; redesigning pr-mode merge authority beyond the marker requirement.

swarm-claim host=elitebook-distributed-server-03 run=21817
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=21817 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #206 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 206,
  "status": "success",
  "commits": [
    "594ebd091e986a860b1dad170a5a93cd5ec3985b"
  ],
  "changed_files": [
    "STATUS.md",
    "close-report-lib.sh",
    "close-report.sh",
    "docs/GOTCHAS.md",
    "landing-lib.sh",
    "onboarding/install-prompt.md",
    "policy-lib.sh",
    "run-swarm.sh",
    "tests/close-report-lib-test.sh",
    "tests/fakebin/curl",
    "tests/landing-lib-test.sh",
    "tests/policy-lib-test.sh"
  ],
  "tests": [
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done (full offline suite)",
      "exit_code": 0
    },
    {
      "command": "bash tests/close-report-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/policy-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/close-report-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "close-report-lib-test.sh: a foreign/pre-existing SHA is refused": "tests/close-report-lib-test.sh T42 (CR_START_SHA set, a commit reachable from main but an ancestor of start is refused 'predates the run start'); gate 1 membership in close-report-lib.sh",
    "close-report-lib-test.sh: an unlisted touched file is refused": "tests/close-report-lib-test.sh gate-2 bidirectional reverse check (a union-diff file absent from changed_files is a violation); close-report-lib.sh gate 2",
    "close-report-lib-test.sh: a self-reported pass whose host re-run fails is refused": "tests/close-report-lib-test.sh T46 (CR_TEST_HOST_EC=1 + status success refused); close-report-lib.sh gate 4b, wired in close-report.sh which re-runs SWARM_POLICY_TEST_CMD",
    "close-report-lib-test.sh: a missing-criteria envelope is refused": "tests/close-report-lib-test.sh T50/T51 (an acceptance-body with no/too-few criteria entries refused); close-report-lib.sh gate 5b, CR_ISSUE_BODY exported by close-report.sh",
    "landing-lib-test.sh: a green PR without the gates-passed marker is not merged by the sweep": "tests/landing-lib-test.sh 'sweep does NOT merge a green orphan lacking the gates-passed marker' + 'green, no marker: reports no-close-report'; landing-lib.sh landing_pr_gates_passed required in landing_merge_if_green",
    "Offline suite green; TEST_CMD defaults correctly when unset": "full suite loop exit 0; tests/policy-lib-test.sh asserts SWARM_POLICY_TEST_CMD empty when absent and loads a custom value; policy-lib.sh TEST_CMD key (default empty)"
  },
  "summary": "Tightened close-report gates 1/2/4b, added criteria gate 5b, and required a verified-close marker before pr-mode agent merges; TEST_CMD is a new empty-default policy key.",
  "blockers": []
}
**close-report** for #206 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 206, "status": "success", "commits": [ "594ebd091e986a860b1dad170a5a93cd5ec3985b" ], "changed_files": [ "STATUS.md", "close-report-lib.sh", "close-report.sh", "docs/GOTCHAS.md", "landing-lib.sh", "onboarding/install-prompt.md", "policy-lib.sh", "run-swarm.sh", "tests/close-report-lib-test.sh", "tests/fakebin/curl", "tests/landing-lib-test.sh", "tests/policy-lib-test.sh" ], "tests": [ { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done (full offline suite)", "exit_code": 0 }, { "command": "bash tests/close-report-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/policy-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/close-report-test.sh", "exit_code": 0 } ], "criteria": { "close-report-lib-test.sh: a foreign/pre-existing SHA is refused": "tests/close-report-lib-test.sh T42 (CR_START_SHA set, a commit reachable from main but an ancestor of start is refused 'predates the run start'); gate 1 membership in close-report-lib.sh", "close-report-lib-test.sh: an unlisted touched file is refused": "tests/close-report-lib-test.sh gate-2 bidirectional reverse check (a union-diff file absent from changed_files is a violation); close-report-lib.sh gate 2", "close-report-lib-test.sh: a self-reported pass whose host re-run fails is refused": "tests/close-report-lib-test.sh T46 (CR_TEST_HOST_EC=1 + status success refused); close-report-lib.sh gate 4b, wired in close-report.sh which re-runs SWARM_POLICY_TEST_CMD", "close-report-lib-test.sh: a missing-criteria envelope is refused": "tests/close-report-lib-test.sh T50/T51 (an acceptance-body with no/too-few criteria entries refused); close-report-lib.sh gate 5b, CR_ISSUE_BODY exported by close-report.sh", "landing-lib-test.sh: a green PR without the gates-passed marker is not merged by the sweep": "tests/landing-lib-test.sh 'sweep does NOT merge a green orphan lacking the gates-passed marker' + 'green, no marker: reports no-close-report'; landing-lib.sh landing_pr_gates_passed required in landing_merge_if_green", "Offline suite green; TEST_CMD defaults correctly when unset": "full suite loop exit 0; tests/policy-lib-test.sh asserts SWARM_POLICY_TEST_CMD empty when absent and loads a custom value; policy-lib.sh TEST_CMD key (default empty)" }, "summary": "Tightened close-report gates 1/2/4b, added criteria gate 5b, and required a verified-close marker before pr-mode agent merges; TEST_CMD is a new empty-default policy key.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#206
No description provided.