close-report false-green: a push-mode run whose host-land never advanced main must not report success "verified against main" and close its ticket #283

Closed
opened 2026-10-17 06:36:30 +00:00 by matou-build-agent · 1 comment

Spun out of #280 item 5 (the deadlock's root enabler).

Symptom

In LANDING=push, close-report.sh runs inside the worker sandbox, before the HOST lands main. Gate 1 verifies the claimed commits are reachable from the pushed per-run worker branch (origin/sandcastle/worker/*) — correct for a pre-land check (close-report.sh:108-135 documents this deliberately). It then closes the issue by a direct PATCH {state:closed} (close-report.sh:574) and posts :white_check_mark: close-report gates passed — every claim verified against main; issue closed. (close-report.sh:581).

But the HOST lands main only after verify_protected_paths. When that post-run gate rolls back and does NOT advance main (exactly what #272/#273/#278 did on every worker run during the deadlock), the issue is already closed against commits that never reached main, and the comment falsely says "verified against main". There is no path that reopens it. This is the inverse of #244 (false refusal) at the same seam — same code, opposite failure, and this direction silently loses landed-looking work.

Evidence: #272 (10d0a8b), #273 (fbdd7d8), #278 all closed success while their fix commits were parked on sandcastle/rescue-* branches, never on main — see #280.

Why it is not a two-way-door quick fix

The sandbox close-report cannot know whether the host's later land will succeed; the design (close-report.sh:108-135) assumes "the host's own post-land check is the backstop" but nothing reopens the issue when that backstop fails. A correct fix spans the host/sandbox boundary — main.mts (host orchestrator, holds the RunResult after the sandbox exits + knows whether verify_protected_paths/the land succeeded), landing-lib.sh, and close-report.sh's ordering/wording. Candidate directions (pick in design):

  1. In push mode, do NOT close the issue from the sandbox — emit the verified-close intent (envelope + gates-passed), and let the HOST close only after it confirms the land advanced main (symmetry with the pr-mode closes #N-on-merge path). If the land rolls back, the host reopens/parks instead.
  2. Keep the sandbox close but make the HOST reconcile: if a run's land did not advance main yet its issue reads closed with a gates-passed marker, the host reopens it (relabel ready-for-session) and says why.
  3. At minimum, correct the wording — a pre-land close verified against the worker branch, not main, and must say so.

Acceptance

  • A push-mode run whose host-land is rolled back (e.g. a verify_protected_paths breach) cannot leave its issue closed claiming success.
  • An offline test drives the host-land-fails path (shimmed, like the existing verify/landing tests) and proves the issue ends OPEN (reopened/parked), red-first.
  • The :white_check_mark: ... verified against main wording is only emitted when main genuinely carries the commits.

Ruled by agent under ADR 0174 (#280) — veto anytime.

Spun out of #280 item 5 (the deadlock's root enabler). ## Symptom In `LANDING=push`, `close-report.sh` runs **inside the worker sandbox, before the HOST lands `main`**. Gate 1 verifies the claimed commits are reachable from the pushed per-run worker branch (`origin/sandcastle/worker/*`) — correct for a *pre-land* check (close-report.sh:108-135 documents this deliberately). It then closes the issue by a direct `PATCH {state:closed}` (close-report.sh:574) and posts `:white_check_mark: close-report gates passed — every claim verified against main; issue closed.` (close-report.sh:581). But the HOST lands `main` only **after** `verify_protected_paths`. When that post-run gate rolls back and does NOT advance `main` (exactly what #272/#273/#278 did on every worker run during the deadlock), the issue is **already closed** against commits that never reached `main`, and the comment falsely says *"verified against main"*. There is no path that reopens it. This is the inverse of #244 (false refusal) at the same seam — same code, opposite failure, and this direction silently loses landed-looking work. Evidence: #272 (`10d0a8b`), #273 (`fbdd7d8`), #278 all closed `success` while their fix commits were parked on `sandcastle/rescue-*` branches, never on `main` — see #280. ## Why it is not a two-way-door quick fix The sandbox close-report cannot know whether the host's later land will succeed; the design (close-report.sh:108-135) assumes "the host's own post-land check is the backstop" but nothing reopens the issue when that backstop fails. A correct fix spans the host/sandbox boundary — `main.mts` (host orchestrator, holds the RunResult after the sandbox exits + knows whether `verify_protected_paths`/the land succeeded), `landing-lib.sh`, and `close-report.sh`'s ordering/wording. Candidate directions (pick in design): 1. In push mode, do NOT close the issue from the sandbox — emit the verified-close *intent* (envelope + gates-passed), and let the HOST close only after it confirms the land advanced `main` (symmetry with the pr-mode `closes #N`-on-merge path). If the land rolls back, the host reopens/parks instead. 2. Keep the sandbox close but make the HOST reconcile: if a run's land did not advance `main` yet its issue reads `closed` with a gates-passed marker, the host reopens it (relabel `ready-for-session`) and says why. 3. At minimum, correct the wording — a pre-land close verified against the **worker branch**, not `main`, and must say so. ## Acceptance - A push-mode run whose host-land is rolled back (e.g. a `verify_protected_paths` breach) cannot leave its issue `closed` claiming `success`. - An offline test drives the host-land-fails path (shimmed, like the existing verify/landing tests) and proves the issue ends OPEN (reopened/parked), red-first. - The `:white_check_mark: ... verified against main` wording is only emitted when `main` genuinely carries the commits. Ruled by agent under ADR 0174 (#280) — veto anytime.
Author
Member

close-report — #283 landed on main (commit d5c4a95)

Ruled by agent under ADR 0174 — veto anytime. Two-way door throughout: every change is a revertible commit, proven by existing-style offline tests (shimmed curl/git, no network), red-first. No one-way door was touched — no credentials, no posture widening, no data destruction.

What landed

A two-part fix for the false-green seam, exactly the three acceptance criteria:

  1. Honest wording (direction 3). close-report.sh now tracks gate_head_desc. A push-mode PRE-land close (gate 1 verified the pushed sandcastle/worker/* branch) now says "verified against the pushed worker branch <wb> (pre-land — the host promotes it to main only after its post-run verify)" — never "verified against main". The default stays main only where main genuinely carries the commits (CR_MAIN_HEAD, or the pr-merged fall-through). → AC3.

  2. The host reconcile (direction 2). New landing_reopen_stranded_closes (landing-lib.sh) + forgejo_reopen_issue (forgejo-lib.sh): on a land that did not advance main (a verify_protected_paths breach, or a landing_stage park), the HOST reopens every issue a sandbox close-report closed against the worker branch — PATCH state:open, relabel ready-for-session, and a comment stating exactly why. It reads the run's SANDCASTLE_ATTEMPT lines, which execute-lib.sh now preserves into EXECUTE_ATTEMPTS_FILE before it cleans the sandcastle log (the log is deleted on success). A reachability guard (git merge-base --is-ancestor <commit> origin/main) means a close whose commits genuinely landed is left closed — only a provably stranded close is reopened. run-swarm.sh calls it on both land-rollback exits. → AC1.

Proof

  • tests/landing-lib-test.sh (+6, #283): stranded → reopen + relabel + comment + echo; commits-on-main → left closed; already-open → untouched; non-success attempt → ignored; absent attempts file → clean no-op. This is the shimmed host-land-fails drive AC2 asks for — it proves the issue ends OPEN, red-first.
  • tests/forgejo-lib-test.sh (+3): forgejo_reopen_issue PATCHes {state:open}.
  • tests/execute-lib-test.sh (+1): the SANDCASTLE_ATTEMPT capture survives the log cleanup, attempt lines only.
  • tests/close-report-test.sh (+2, WB-1): a pre-land close names the worker branch and must not claim "against main".
  • tests/run-swarm-landing-test.sh (+1): static wiring on both rollback exits + EXECUTE_ATTEMPTS_FILE.
  • Full offline suite green (for t in tests/*.sh onboarding/tests/*.sh; … → ALL GREEN), re-run after a clean git pull --rebase.

Scope / residue (two-way, noted — no human door)

  • Inert until re-vendor. This is a ROOT change; the running .sandcastle/ self-copy picks it up only at the next coordinated FACTORY_REF re-vendor (GOTCHAS 4). The fix does not take effect in the live drainer until a human bumps the pin — recorded in the STATUS.md header.
  • Adjacent case left as a follow-up (not this ticket): a generic-red sandcastle run that closed an earlier iteration's issue is the same bug class, but it exits before the verify stage and writes no attempts file, so the reconcile does not cover it. Filing separately rather than widening scope.

Journal: docs/journal/2026-10-17-283.md. Closing as done + proven.

## close-report — #283 landed on `main` (commit `d5c4a95`) **Ruled by agent under ADR 0174 — veto anytime.** Two-way door throughout: every change is a revertible commit, proven by existing-style offline tests (shimmed `curl`/`git`, no network), red-first. No one-way door was touched — no credentials, no posture widening, no data destruction. ### What landed A two-part fix for the false-green seam, exactly the three acceptance criteria: 1. **Honest wording (direction 3).** `close-report.sh` now tracks `gate_head_desc`. A push-mode PRE-land close (gate 1 verified the pushed `sandcastle/worker/*` branch) now says *"verified against the pushed worker branch `<wb>` (pre-land — the host promotes it to `main` only after its post-run verify)"* — never *"verified against main"*. The default stays `main` only where `main` genuinely carries the commits (`CR_MAIN_HEAD`, or the pr-merged fall-through). **→ AC3.** 2. **The host reconcile (direction 2).** New `landing_reopen_stranded_closes` (`landing-lib.sh`) + `forgejo_reopen_issue` (`forgejo-lib.sh`): on a land that did **not** advance `main` (a `verify_protected_paths` breach, or a `landing_stage` park), the HOST reopens every issue a sandbox close-report closed against the worker branch — `PATCH state:open`, relabel `ready-for-session`, and a comment stating exactly why. It reads the run's `SANDCASTLE_ATTEMPT` lines, which `execute-lib.sh` now preserves into `EXECUTE_ATTEMPTS_FILE` before it cleans the sandcastle log (the log is deleted on success). A **reachability guard** (`git merge-base --is-ancestor <commit> origin/main`) means a close whose commits genuinely landed is left closed — only a provably stranded close is reopened. `run-swarm.sh` calls it on **both** land-rollback exits. **→ AC1.** ### Proof - `tests/landing-lib-test.sh` (+6, #283): stranded → reopen + relabel + comment + echo; commits-on-main → left closed; already-open → untouched; non-success attempt → ignored; absent attempts file → clean no-op. **This is the shimmed host-land-fails drive AC2 asks for — it proves the issue ends OPEN, red-first.** - `tests/forgejo-lib-test.sh` (+3): `forgejo_reopen_issue` PATCHes `{state:open}`. - `tests/execute-lib-test.sh` (+1): the `SANDCASTLE_ATTEMPT` capture survives the log cleanup, attempt lines only. - `tests/close-report-test.sh` (+2, WB-1): a pre-land close names the worker branch and must **not** claim "against main". - `tests/run-swarm-landing-test.sh` (+1): static wiring on both rollback exits + `EXECUTE_ATTEMPTS_FILE`. - **Full offline suite green** (`for t in tests/*.sh onboarding/tests/*.sh; …` → ALL GREEN), re-run after a clean `git pull --rebase`. ### Scope / residue (two-way, noted — no human door) - **Inert until re-vendor.** This is a ROOT change; the running `.sandcastle/` self-copy picks it up only at the next coordinated `FACTORY_REF` re-vendor (GOTCHAS 4). The fix does not take effect in the live drainer until a human bumps the pin — recorded in the STATUS.md header. - **Adjacent case left as a follow-up (not this ticket):** a *generic-red* sandcastle run that closed an earlier iteration's issue is the same bug class, but it exits before the verify stage and writes no attempts file, so the reconcile does not cover it. Filing separately rather than widening scope. Journal: `docs/journal/2026-10-17-283.md`. Closing as done + proven.
matou-build-agent 2026-10-17 07:00:06 +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/dev-factory#283
No description provided.