Swarm worker close-report envelope + claim gates on issue-close #444

Closed
opened 2026-08-11 22:15:58 +00:00 by ben · 1 comment
Owner

Context

Learning L1 of docs/research/2026-08-11-software-factory-learnings.md: the swarm's false-green class (drive 15, drive 185108Z
GREEN-with-faulted-leg, the all-skipped deploy masquerading as S5x, #435
green-and-empty) shares one root: the worker's verdict is accepted at
issue-close on its word, and audited only later (code-review / design-verify /
eyeballs). SSSF's answer is "agent proposes, code disposes": typed output +
deterministic gates that verify the agent's claims after the fact.

What to build

Before a swarm worker may close a ticket, it must emit a structured
close-report envelope (JSON), and deterministic code in the swarm harness
(.sandcastle/run-swarm.sh or a new close-report-lib.sh, NOT an agent) must
verify the claims before the close is allowed to stand.

Envelope fields (minimum):

  • issue: the ticket number being closed
  • status: success | blocked | refused — a refusal/blocked MUST name a reason
  • commits: list of commit SHAs produced for this ticket
  • changed_files: paths the worker claims it changed
  • tests: list of {command, exit_code} actually run
  • criteria: map of the ticket's acceptance criteria (or a summary of each) to
    the evidence satisfying it (commit, file, test, or comment link)
  • summary: one sentence

Claim gates (all deterministic, all must pass before close):

  1. every SHA in commits is reachable from the pushed head of main
  2. every path in changed_files appears in the union diff of those commits
  3. status: success requires at least one commit OR an explicit
    no-code-change marker with a reason
  4. a tests entry claiming pass has exit_code: 0; status: success with a
    non-zero test exit is refuted
  5. verdict consistency: status: success with unresolved blocking items named
    anywhere in the envelope is refuted; status: refused|blocked with no
    reason is refuted (this is the 165115Z "label refusals loud" fix made law
    for every verdict producer)

On gate failure: the worker gets the verbatim violation list back (same
iteration if feasible), bounded retries (2), then the ticket goes
agent-blocked with the envelope + violations posted as a comment. The
envelope (valid or not) is always posted as the close comment / a comment, so
the issue thread carries the evidence.

Acceptance criteria

  • Worker prompt (.sandcastle/prompt.md) requires the envelope at close;
    format documented in the prompt itself
  • Gate library verifies claims 1–5 in bash/jq; fails closed
  • A false claim (fabricated SHA, claimed-passing test with exit 1) is
    demonstrably refused in a test fixture under .sandcastle/tests/
  • A refused/blocked close without a reason is refused
  • Envelope lands on the issue as a comment in all outcomes
  • docs/GOTCHAS.md gains an entry only if a hazard is discovered while
    building this (per ADR 0160)

References

  • docs/research/2026-08-11-software-factory-learnings.md (L1)
  • SSSF gates.py (verdict_consistent, artifacts_exist,
    diff_matches_claims) and references/handoff.md in
    disler/super-simple-software-factory — the pattern source
## Context Learning L1 of `docs/research/2026-08-11-software-factory-learnings.md`: the swarm's false-green class (drive 15, drive 185108Z GREEN-with-faulted-leg, the all-skipped deploy masquerading as S5x, #435 green-and-empty) shares one root: the worker's verdict is accepted at issue-close on its word, and audited only later (code-review / design-verify / eyeballs). SSSF's answer is "agent proposes, code disposes": typed output + deterministic gates that verify the agent's claims after the fact. ## What to build Before a swarm worker may close a ticket, it must emit a structured **close-report envelope** (JSON), and deterministic code in the swarm harness (`.sandcastle/run-swarm.sh` or a new `close-report-lib.sh`, NOT an agent) must verify the claims before the close is allowed to stand. Envelope fields (minimum): - `issue`: the ticket number being closed - `status`: `success | blocked | refused` — a refusal/blocked MUST name a reason - `commits`: list of commit SHAs produced for this ticket - `changed_files`: paths the worker claims it changed - `tests`: list of `{command, exit_code}` actually run - `criteria`: map of the ticket's acceptance criteria (or a summary of each) to the evidence satisfying it (commit, file, test, or comment link) - `summary`: one sentence Claim gates (all deterministic, all must pass before close): 1. every SHA in `commits` is reachable from the pushed head of `main` 2. every path in `changed_files` appears in the union diff of those commits 3. `status: success` requires at least one commit OR an explicit `no-code-change` marker with a reason 4. a `tests` entry claiming pass has `exit_code: 0`; `status: success` with a non-zero test exit is refuted 5. verdict consistency: `status: success` with unresolved blocking items named anywhere in the envelope is refuted; `status: refused|blocked` with no reason is refuted (this is the 165115Z "label refusals loud" fix made law for every verdict producer) On gate failure: the worker gets the verbatim violation list back (same iteration if feasible), bounded retries (2), then the ticket goes `agent-blocked` with the envelope + violations posted as a comment. The envelope (valid or not) is always posted as the close comment / a comment, so the issue thread carries the evidence. ## Acceptance criteria - [ ] Worker prompt (`.sandcastle/prompt.md`) requires the envelope at close; format documented in the prompt itself - [ ] Gate library verifies claims 1–5 in bash/jq; fails closed - [ ] A false claim (fabricated SHA, claimed-passing test with exit 1) is demonstrably refused in a test fixture under `.sandcastle/tests/` - [ ] A refused/blocked close without a reason is refused - [ ] Envelope lands on the issue as a comment in all outcomes - [ ] `docs/GOTCHAS.md` gains an entry only if a hazard is discovered while building this (per ADR 0160) ## References - `docs/research/2026-08-11-software-factory-learnings.md` (L1) - SSSF `gates.py` (`verdict_consistent`, `artifacts_exist`, `diff_matches_claims`) and `references/handoff.md` in `disler/super-simple-software-factory` — the pattern source
Author
Owner

close-report for #444 — status success

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

envelope
{
  "issue": 444,
  "status": "success",
  "commits": [
    "c2acc6b8e2eaa3ea018178d1d9c994caa3d75678"
  ],
  "changed_files": [
    ".sandcastle/README.md",
    ".sandcastle/close-report-lib.sh",
    ".sandcastle/close-report.sh",
    ".sandcastle/preflight-swarm.sh",
    ".sandcastle/prompt.md",
    ".sandcastle/tests/close-report-lib-test.sh",
    ".sandcastle/tests/close-report-test.sh",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash .sandcastle/tests/close-report-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash .sandcastle/tests/close-report-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash .sandcastle/preflight-swarm.sh",
      "exit_code": 0
    },
    {
      "command": "bash .sandcastle/tests/gate-lib-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Worker prompt requires the envelope at close; format documented in the prompt": "prompt.md step 7 rewritten with the JSON schema + gate list @c2acc6b8e2eaa3ea018178d1d9c994caa3d75678",
    "Gate library verifies claims 1-5 in bash/jq; fails closed": ".sandcastle/close-report-lib.sh cr_violations @c2acc6b8e2eaa3ea018178d1d9c994caa3d75678",
    "A false claim (fabricated SHA, claimed-passing test with exit 1) is refused in a fixture": "tests/close-report-lib-test.sh T2/T7 + tests/close-report-test.sh T2 (15+14 checks pass)",
    "A refused/blocked close without a reason is refused": "close-report-lib-test.sh T10 (gate 5)",
    "Envelope lands on the issue as a comment in all outcomes": "close-report.sh posts before deciding; close-report-test.sh T1-T3 assert it",
    "GOTCHAS entry only if a hazard discovered": "no operational hazard found while building — no entry added (per ADR 0160)"
  },
  "summary": "Swarm workers now close tickets only through a deterministic close-report claim gate that re-derives every claim from git and fails closed.",
  "blockers": []
}
**close-report** for #444 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 444, "status": "success", "commits": [ "c2acc6b8e2eaa3ea018178d1d9c994caa3d75678" ], "changed_files": [ ".sandcastle/README.md", ".sandcastle/close-report-lib.sh", ".sandcastle/close-report.sh", ".sandcastle/preflight-swarm.sh", ".sandcastle/prompt.md", ".sandcastle/tests/close-report-lib-test.sh", ".sandcastle/tests/close-report-test.sh", "STATUS.md" ], "tests": [ { "command": "bash .sandcastle/tests/close-report-lib-test.sh", "exit_code": 0 }, { "command": "bash .sandcastle/tests/close-report-test.sh", "exit_code": 0 }, { "command": "bash .sandcastle/preflight-swarm.sh", "exit_code": 0 }, { "command": "bash .sandcastle/tests/gate-lib-test.sh", "exit_code": 0 } ], "criteria": { "Worker prompt requires the envelope at close; format documented in the prompt": "prompt.md step 7 rewritten with the JSON schema + gate list @c2acc6b8e2eaa3ea018178d1d9c994caa3d75678", "Gate library verifies claims 1-5 in bash/jq; fails closed": ".sandcastle/close-report-lib.sh cr_violations @c2acc6b8e2eaa3ea018178d1d9c994caa3d75678", "A false claim (fabricated SHA, claimed-passing test with exit 1) is refused in a fixture": "tests/close-report-lib-test.sh T2/T7 + tests/close-report-test.sh T2 (15+14 checks pass)", "A refused/blocked close without a reason is refused": "close-report-lib-test.sh T10 (gate 5)", "Envelope lands on the issue as a comment in all outcomes": "close-report.sh posts before deciding; close-report-test.sh T1-T3 assert it", "GOTCHAS entry only if a hazard discovered": "no operational hazard found while building — no entry added (per ADR 0160)" }, "summary": "Swarm workers now close tickets only through a deterministic close-report claim gate that re-derives every claim from git and fails closed.", "blockers": [] } ``` </details>
ben 2026-08-12 00:26:50 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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/idss#444
No description provided.