reporter: a 503 on POST /issues can follow a STORED issue — re-query by rehearsal-sig before parking the drive (4 duplicates/unwired filings on 2026-09-05) #1245

Closed
opened 2026-09-05 22:21:54 +00:00 by ben · 6 comments
Owner

The hazard

Four times on 2026-09-05 Forgejo STORED an issue and then answered the POST /issues with a 503 (or a non-JSON body): #1240 (reporter, 20:21Z), #1241 (reporter, 21:10Z), #1243 (reporter, 22:06Z), #1244 (by hand, 22:20Z — the create returned a non-JSON body while the issue existed). The reporter (.sandcastle/rehearsal-report.sh) reads the failed POST as "could not file", so:

  • it posts RED but nothing could be filed or matched (cap/limit) — flipped ready-for-human on the drive ticket and parks it, while the filed issue exists with NO blocked-by wiring and NO "now blocked by" comment;
  • a retry (or the next red with the same sig) files a duplicate — #1241 duplicated #1242's diagnosis and had to be closed by hand;
  • every stored-but-unacknowledged issue still counts against REHEARSAL_FILING_CAP, so the cap trips one drive earlier than intended.

Every one of those issues carries the <!-- rehearsal-sig: <sig> --> marker in its body, which is exactly the key the match rail (rail 6) already searches.

What to build (harness: .sandcastle/rehearsal-report.sh + forgejo-lib.sh)

  1. After a create POST that does not return a parsable issue number, re-query the tracker for an OPEN issue whose body carries this run's rehearsal-sig (the same search the match rail runs) — once, after a short back-off (the 503s clear within seconds). If found, treat it as the filed issue: wire blocked-by, post the "now blocked by" comment, apply the labels the create meant to apply (a stored-on-503 issue arrived with the create's labels but nothing else).
  2. Only if the re-query also finds nothing: the existing "could not file" park.
  3. The same re-query guard on the blocked-by / comment POSTs: a 503 there must retry once before the run is declared unwired.
  4. scripts/tests/ (or the reporter's own test file): a fake tracker that stores then 503s proves the re-query path files ONE issue and wires it; a fake that stores nothing proves the park still happens.

Acceptance

A stored-then-503 create produces exactly one issue, wired to the drive ticket, with no ready-for-human park; the filing cap counts it once.

## The hazard Four times on 2026-09-05 Forgejo STORED an issue and then answered the `POST /issues` with a 503 (or a non-JSON body): #1240 (reporter, 20:21Z), #1241 (reporter, 21:10Z), #1243 (reporter, 22:06Z), #1244 (by hand, 22:20Z — the create returned a non-JSON body while the issue existed). The reporter (`.sandcastle/rehearsal-report.sh`) reads the failed POST as "could not file", so: - it posts `RED but nothing could be filed or matched (cap/limit) — flipped ready-for-human` on the drive ticket and parks it, while the filed issue exists with NO blocked-by wiring and NO "now blocked by" comment; - a retry (or the next red with the same sig) files a duplicate — #1241 duplicated #1242's diagnosis and had to be closed by hand; - every stored-but-unacknowledged issue still counts against `REHEARSAL_FILING_CAP`, so the cap trips one drive earlier than intended. Every one of those issues carries the `<!-- rehearsal-sig: <sig> -->` marker in its body, which is exactly the key the match rail (rail 6) already searches. ## What to build (harness: `.sandcastle/rehearsal-report.sh` + `forgejo-lib.sh`) 1. After a create POST that does not return a parsable issue number, re-query the tracker for an OPEN issue whose body carries this run's `rehearsal-sig` (the same search the match rail runs) — once, after a short back-off (the 503s clear within seconds). If found, treat it as the filed issue: wire blocked-by, post the "now blocked by" comment, apply the labels the create meant to apply (a stored-on-503 issue arrived with the create's labels but nothing else). 2. Only if the re-query also finds nothing: the existing "could not file" park. 3. The same re-query guard on the blocked-by / comment POSTs: a 503 there must retry once before the run is declared unwired. 4. `scripts/tests/` (or the reporter's own test file): a fake tracker that stores then 503s proves the re-query path files ONE issue and wires it; a fake that stores nothing proves the park still happens. ## Acceptance A stored-then-503 create produces exactly one issue, wired to the drive ticket, with no ready-for-human park; the filing cap counts it once.

swarm-claim host=matou-dev-server-01 run=18588
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18588 (automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18588
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18588 (automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18588
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=18588 (automated multi-host claim — lowest live claim id works this ticket)

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

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

This ticket cannot be worked by a Sandcastle agent — its entire deliverable is a change to protected .sandcastle/ machinery.

The two files the task names — .sandcastle/rehearsal-report.sh and .sandcastle/forgejo-lib.sh — are both inside .sandcastle/, which is a fingerprinted protected directory (protected-paths-lib.sh, #445: PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"). Any protected-path content a worker introduces, deletes, or changes is attributed, rolled back, and the run failed loud — git-fence is only a backstop. So a worker physically cannot land the re-query fix here; the reporter test alone (item 4) is meaningless without the implementation it exercises, which is protected.

Per the agent rules (Rule 9) and the protected-paths escape message, a .sandcastle/ machinery change needs an interactive session's standing (ADR 0174, #445) — ready-for-session — where a session rules on the machinery change itself and escalates to ready-for-human only if it finds a genuine one-way door. This ticket already fully describes the machinery change (the stored-then-503 re-query-by-rehearsal-sig fix, plus the blocked-by/comment retry guard and the reporter test), so rather than file a duplicate I am re-routing this issue: removing ready-for-agent, adding ready-for-session. No code change was attempted; no protected path was touched.

This ticket cannot be worked by a Sandcastle agent — its entire deliverable is a change to **protected `.sandcastle/` machinery**. The two files the task names — `.sandcastle/rehearsal-report.sh` and `.sandcastle/forgejo-lib.sh` — are both inside `.sandcastle/`, which is a fingerprinted protected directory (`protected-paths-lib.sh`, #445: `PP_PROTECTED_DIRS_DEFAULT=".sandcastle .forgejo"`). Any protected-path content a worker introduces, deletes, or changes is attributed, **rolled back, and the run failed loud** — `git-fence` is only a backstop. So a worker physically cannot land the re-query fix here; the reporter test alone (item 4) is meaningless without the implementation it exercises, which is protected. Per the agent rules (Rule 9) and the protected-paths escape message, a `.sandcastle/` machinery change needs an **interactive session's standing (ADR 0174, #445)** — `ready-for-session` — where a session rules on the machinery change itself and escalates to `ready-for-human` only if it finds a genuine one-way door. This ticket already fully describes the machinery change (the stored-then-503 re-query-by-rehearsal-sig fix, plus the blocked-by/comment retry guard and the reporter test), so rather than file a duplicate I am re-routing this issue: removing `ready-for-agent`, adding `ready-for-session`. No code change was attempted; no protected path was touched.

Close-report — Ruled by agent under ADR 0174 (two-way door; veto anytime).

The stored-then-503 hazard is closed. Because rehearsal-report.sh is factory-vendored (ADR 0180 / FACTORY_MANIFEST), the fix landed upstream in Matou/dev-factory and was re-vendored here.

What landed

  • After a create POST /issues that returns no parsable issue number (a curl--f 503 failure or a 200 with a non-JSON body — the #1240/#1241/#1243/#1244 shape), the reporter re-queries once after a short back-off (REPORTER_CREATE_REQUERY_DELAY, default 5 s) for an OPEN issue whose body carries this run's rehearsal-sig — the exact key the match rail (rail 6) already searches.
    • Found → treat it as the filed issue: it flows into touched, so the drive-issue loop wires blocked-by + posts the "now blocked by" comment; the create's intended labels are re-applied idempotently (POST /labels adds, so a label already present is a no-op); it counts against REHEARSAL_FILING_CAP exactly once.
    • Not found → falls through to the existing "could not file" park unchanged.
  • The same back-off now guards the wiring POSTs (item 3): a non-2xx/409 on the blocked-by dependency and on the "now blocked by" comment retries once before the run is declared unwired (a stored-behind-503 dependency answers 409 on the retry, which is tolerated).
  • A stored create that returns rc-success-but-empty-number no longer increments new_filed for a phantom — the cap now counts a genuinely-failed create as zero, a stored one as one.

Proof (tests/rehearsal-report-test.sh, drives the REAL reporter with a shimmed stateful tracker + claude; 46 → 48 cases):

  • Case 39 — a fake tracker that STORES then answers 503 (rc 22, empty body): asserts exactly one create POST (no duplicate), the stored issue #777 is wired onto the drive (/dependencies names index 777), its labels are re-applied (777/labels), the "now blocked by" comment lands, and the drive is NOT flipped ready-for-human.
  • Case 40 — a fake that 503s and stores nothing: the re-query finds nothing, so the drive still parks ready-for-human and no phantom dependency is wired (the re-query guard didn't swallow a real failure).
  • Reporter-adjacent suites re-run green upstream: rehearsal-healer-test (19), rehearsal-heal-lib-test (26), forgejo-lib-test (53).

Commits / provenance

  • dev-factory 529cb1f1 (Matou/dev-factory@main): the reporter change + 2 tests + STATUS.
  • idss ffc95aed: re-vendor — FACTORY_REF 1ff3485f → 529cb1f1, check-harness-drift.sh OK, vendored rehearsal-report-test.sh green here (48). (The bump pulls 6 intervening upstream commits — check-harness-drift + a few libs — expected on any pin bump, ADR 0180.)

Acceptance met: a stored-then-503 create produces exactly one issue, wired to the drive ticket, with no ready-for-human park; the filing cap counts it once. Closing.

**Close-report — Ruled by agent under ADR 0174 (two-way door; veto anytime).** The stored-then-503 hazard is closed. Because `rehearsal-report.sh` is factory-vendored (ADR 0180 / `FACTORY_MANIFEST`), the fix landed **upstream in `Matou/dev-factory`** and was re-vendored here. **What landed** - After a create `POST /issues` that returns **no parsable issue number** (a curl-`-f` 503 failure *or* a 200 with a non-JSON body — the #1240/#1241/#1243/#1244 shape), the reporter re-queries **once** after a short back-off (`REPORTER_CREATE_REQUERY_DELAY`, default 5 s) for an OPEN issue whose body carries **this run's `rehearsal-sig`** — the exact key the match rail (rail 6) already searches. - **Found** → treat it as the filed issue: it flows into `touched`, so the drive-issue loop wires blocked-by + posts the "now blocked by" comment; the create's intended labels are re-applied **idempotently** (`POST /labels` adds, so a label already present is a no-op); it counts against `REHEARSAL_FILING_CAP` **exactly once**. - **Not found** → falls through to the existing "could not file" park unchanged. - The **same back-off** now guards the wiring POSTs (item 3): a non-2xx/409 on the blocked-by dependency **and** on the "now blocked by" comment retries once before the run is declared unwired (a stored-behind-503 dependency answers 409 on the retry, which is tolerated). - A stored create that returns rc-success-but-empty-number no longer increments `new_filed` for a phantom — the cap now counts a genuinely-failed create as **zero**, a stored one as **one**. **Proof** (`tests/rehearsal-report-test.sh`, drives the REAL reporter with a shimmed stateful tracker + claude; **46 → 48 cases**): - **Case 39** — a fake tracker that STORES then answers 503 (rc 22, empty body): asserts exactly **one** create POST (no duplicate), the stored issue `#777` is wired onto the drive (`/dependencies` names index 777), its labels are re-applied (`777/labels`), the "now blocked by" comment lands, and the drive is **NOT** flipped `ready-for-human`. - **Case 40** — a fake that 503s and stores **nothing**: the re-query finds nothing, so the drive still parks `ready-for-human` and **no** phantom dependency is wired (the re-query guard didn't swallow a real failure). - Reporter-adjacent suites re-run green upstream: `rehearsal-healer-test` (19), `rehearsal-heal-lib-test` (26), `forgejo-lib-test` (53). **Commits / provenance** - dev-factory `529cb1f1` (`Matou/dev-factory@main`): the reporter change + 2 tests + STATUS. - idss `ffc95aed`: re-vendor — `FACTORY_REF 1ff3485f → 529cb1f1`, `check-harness-drift.sh` **OK**, vendored `rehearsal-report-test.sh` green here (48). (The bump pulls 6 intervening upstream commits — check-harness-drift + a few libs — expected on any pin bump, ADR 0180.) Acceptance met: a stored-then-503 create produces exactly one issue, wired to the drive ticket, with no `ready-for-human` park; the filing cap counts it once. Closing.
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/idss#1245
No description provided.