#283 reconcile reopens an already-landed ticket when a re-attempt's land is a no-op (spurious #52 reopen loop) #372

Closed
opened 2026-11-19 19:35:25 +00:00 by matou-build-agent · 4 comments

Symptom

Ticket #52 (the transient-5xx ready-list fix) was genuinely landed and closed on 2026-08-24 — its fix commit 866dc37 is byte-for-byte on origin/main, all four acceptance criteria are met, and its tests (tests/run-swarm-ready-list-test.sh, tests/schedule-lib-test.sh, tests/run-swarm-stages-test.sh) pass today.

Despite that, on 2026-11-19 19:29:25Z the matou-build-agent #283 landing_reopen_stranded_closes reconcile reopened #52 (and relabelled it ready-for-session), with the comment:

Reopened — a push-mode close did NOT land on main (#283). close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (the promote did not advance main (a no-op push to main)), so origin/main never carried the commits (354f9df6966b7090dfebcc5b39506ae3e20d97ba).

That commit 354f9df… does not exist in the repo, and the rescue branch the run parked (sandcastle/rescue-20261119-193223) has its tip at fc4c1c2 — an ancestor of main, zero commits and zero diff versus origin/main. The re-attempt produced nothing that was not already landed.

Root cause (hypothesis for triage)

A worker re-worked an already-landed ticket. Its "land" was therefore a legitimate no-op push to main (the fix is already there, byte-identical). The host's #193 land-after-verify correctly saw "main did not advance", and the #283 reconcile mis-classified that no-op as a stranded close and reopened the ticket.

This drives a loop: reopen → ready-for-session → a session (or worker) re-does the already-done work → no-op land → #283 reopens again. It burns session-runner / worker cycles on a ticket with nothing to do, and self-heals only by a human (or an informed session) closing it and keeping it closed. It is in the #359 / #283 push-close-before-land family but is a distinct edge: "nothing to land because it is already landed" is not the same as "stranded close whose commits never reached main", yet both present as "no-op push to main" to the reconcile.

Open question for triage (could not be reconstructed from the tracker timeline alone): why was a closed, already-landed #52 re-worked at all on 2026-11-19? The issue was closed 2026-08-24 → 2026-11-19 19:29 with no intervening reopen event, yet a worker run that ended ~19:29 had an attempt record closing #52 against 354f9df. Ben referenced #52 from #359 at 14:04 that day. The trigger (stale fleet-pick, a maxIterations batch, or a test/replay against a stale .sandcastle copy) needs the run log for run that parked rescue-20261119-193223.

Suggested fix direction

The #283 reconcile should distinguish a no-op-because-already-landed close (the ticket's recorded close commits, or an equivalent fix, are reachable from origin/main) from a genuinely stranded close (the commits exist on a branch but are not on main). The former must NOT reopen the ticket — it is already satisfied. Guard landing_reopen_stranded_closes so an attempt whose produced diff is empty against origin/main (nothing to strand) is a no-op, not a reopen.

Provenance

Filed by the session-runner standing session that was dispatched #52 on 2026-11-19 and found it already complete on main (close-report on #52). Advances #359's family.

## Symptom Ticket #52 (the transient-5xx ready-list fix) was **genuinely landed and closed on 2026-08-24** — its fix commit `866dc37` is byte-for-byte on `origin/main`, all four acceptance criteria are met, and its tests (`tests/run-swarm-ready-list-test.sh`, `tests/schedule-lib-test.sh`, `tests/run-swarm-stages-test.sh`) pass today. Despite that, on **2026-11-19 19:29:25Z** the `matou-build-agent` **#283 `landing_reopen_stranded_closes` reconcile reopened #52** (and relabelled it `ready-for-session`), with the comment: > Reopened — a push-mode close did NOT land on `main` (#283). close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (`the promote did not advance main (a no-op push to main)`), so `origin/main` never carried the commits (`354f9df6966b7090dfebcc5b39506ae3e20d97ba`). That commit `354f9df…` does **not exist** in the repo, and the rescue branch the run parked (`sandcastle/rescue-20261119-193223`) has its tip at `fc4c1c2` — an **ancestor of `main`, zero commits and zero diff versus `origin/main`**. The re-attempt produced nothing that was not already landed. ## Root cause (hypothesis for triage) A worker re-worked an **already-landed** ticket. Its "land" was therefore a legitimate **no-op push to `main`** (the fix is already there, byte-identical). The host's #193 land-after-verify correctly saw "main did not advance", and the #283 reconcile **mis-classified that no-op as a stranded close** and reopened the ticket. This drives a loop: reopen → `ready-for-session` → a session (or worker) re-does the already-done work → no-op land → #283 reopens again. It burns session-runner / worker cycles on a ticket with nothing to do, and self-heals only by a human (or an informed session) closing it and keeping it closed. It is in the #359 / #283 push-close-before-land family but is a distinct edge: **"nothing to land because it is already landed"** is not the same as **"stranded close whose commits never reached main"**, yet both present as "no-op push to main" to the reconcile. Open question for triage (could not be reconstructed from the tracker timeline alone): **why was a closed, already-landed #52 re-worked at all on 2026-11-19?** The issue was closed 2026-08-24 → 2026-11-19 19:29 with no intervening `reopen` event, yet a worker run that ended ~19:29 had an attempt record closing #52 against `354f9df`. Ben referenced #52 from #359 at 14:04 that day. The trigger (stale fleet-pick, a maxIterations batch, or a test/replay against a stale `.sandcastle` copy) needs the run log for run that parked `rescue-20261119-193223`. ## Suggested fix direction The #283 reconcile should distinguish a **no-op-because-already-landed** close (the ticket's recorded close commits, or an equivalent fix, are reachable from `origin/main`) from a **genuinely stranded** close (the commits exist on a branch but are not on main). The former must NOT reopen the ticket — it is already satisfied. Guard `landing_reopen_stranded_closes` so an attempt whose produced diff is empty against `origin/main` (nothing to strand) is a no-op, not a reopen. ## Provenance Filed by the session-runner standing session that was dispatched #52 on 2026-11-19 and found it already complete on `main` (close-report on #52). Advances #359's family.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: bug + ready-for-agent.

Why a two-way door: the fix is a guard inside landing_reopen_stranded_closes in the root harness lib landing-lib.sh (not a prompt skeleton, not .sandcastle/, not .forgejo/, no credential, no live door, no spend, no security-posture change). It is revertible by a later commit and provable offline by a unit test in tests/landing-lib-test.sh, which already shims the reconcile's git/tracker calls (ANCESTOR_RC, ISSUE_STATE) and exercises the #283 / #2119 reopen cases. Nothing here needs Ben's hands, Ben's eyes, or a one-way-door ruling.

What proves the symptom (verified during triage):

  • #52's fix commit 866dc37 is on origin/main (git merge-base --is-ancestor 866dc37 origin/main → true).
  • The claimed close commit 354f9df6966b7090dfebcc5b39506ae3e20d97ba does not exist in the repo (git cat-file -t → fatal).
  • The rescue branch tip fc4c1c2 is an ancestor of main (zero commits, zero diff vs origin/main).
  • #52 currently reads open + ready-for-session — i.e. the spurious reopen described here already fired.

Agent Brief

Category: bug
Summary: landing_reopen_stranded_closes (#283 reconcile) mis-classifies a no-op "already-landed" close as a stranded close and reopens the ticket, driving a reopen → ready-for-session → re-do → no-op-land → reopen loop.

Current behavior:
The reconcile decides "stranded" purely from the attempt record's claimed commit SHAs: for an outcome=success line, if any claimed commit is not an ancestor of origin/main, it reopens the (closed) issue, relabels ready-for-session, and comments. When a worker re-works a ticket whose fix is already byte-identically on main under a different SHA, the re-attempt's own commits are legitimately absent from main (its "land" was a correct no-op push). The ancestry test therefore fails on commits that represent nothing new, so an already-satisfied ticket is reopened. This is distinct from a genuine stranded close (commits exist on a branch but never reached main): both present to the reconcile as "no-op push to main," but only one lost work.

Desired behavior:
An attempt that produced nothing not already on main must be a no-op for the reconcile, not a reopen. A genuinely stranded close (its commits exist off-main and carry a real diff that never landed) must still reopen exactly as today. The agent chooses the discriminating signal; candidates that fit the observed case:

  • the attempt's claimed commits are unreachable/non-existent in the repo (cannot be "stranded on a branch" if they do not exist), versus existing-but-not-on-main; and/or
  • the run's parked rescue branch has an empty diff against origin/main (nothing to strand).
    Pick the signal that cleanly separates the two cases and is checkable from what the reconcile already has (the attempts file, git, the rescue branch ref) without new tracker round-trips where avoidable.

Key interfaces:

  • landing_reopen_stranded_closes <attempts-file> <repo-slug> [main-ref] in landing-lib.sh — add the guard so an empty-diff / already-landed attempt skips the reopen while a real stranded close still reopens.
  • Keep the existing safety ordering intact: the ancestry guard, the "only reopen a currently-closed issue" check, landing_drop_run_claims, relabel + comment.
  • Comment copy, if the issue is a real stranded close, is unchanged; the guard only adds a skip branch.

Acceptance criteria:

  • A success attempt whose fix is already on main (its claimed commits non-existent / empty diff vs origin/main) is not reopened and echoes nothing — a new case in tests/landing-lib-test.sh.
  • A genuinely stranded close (commits exist off-main, real diff, issue closed) is still reopened + relabelled + commented + echoed, exactly as the existing #283 tests assert.
  • The existing #283 / #2119 / #366 reopen tests still pass unchanged.
  • landing-lib.sh change ships with its test in the same commit; the offline suite (tests/landing-lib-test.sh) is green.

Out of scope:

  • The separate open question of why a closed, already-landed #52 was re-worked at all on 2026-11-19 (stale fleet-pick, maxIterations batch, replay against a stale .sandcastle copy). That needs forensics on the run log that parked rescue-20261119-193223 — file it as a follow-up if confirmed; it does not block this guard, which is correct regardless of the trigger.
  • Manually re-closing #52 (a human/session will reconcile that ticket's state separately; it is already ready-for-session).
  • Any change to the success-path counterpart landing_promote_landed beyond what symmetry with the new guard strictly requires.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `bug` + `ready-for-agent`. **Why a two-way door:** the fix is a guard inside `landing_reopen_stranded_closes` in the root harness lib `landing-lib.sh` (not a prompt skeleton, not `.sandcastle/`, not `.forgejo/`, no credential, no live door, no spend, no security-posture change). It is revertible by a later commit and provable offline by a unit test in `tests/landing-lib-test.sh`, which already shims the reconcile's git/tracker calls (`ANCESTOR_RC`, `ISSUE_STATE`) and exercises the `#283` / `#2119` reopen cases. Nothing here needs Ben's hands, Ben's eyes, or a one-way-door ruling. **What proves the symptom (verified during triage):** - #52's fix commit `866dc37` **is** on `origin/main` (`git merge-base --is-ancestor 866dc37 origin/main` → true). - The claimed close commit `354f9df6966b7090dfebcc5b39506ae3e20d97ba` **does not exist** in the repo (`git cat-file -t` → fatal). - The rescue branch tip `fc4c1c2` **is** an ancestor of `main` (zero commits, zero diff vs `origin/main`). - #52 currently reads **open** + `ready-for-session` — i.e. the spurious reopen described here already fired. --- ## Agent Brief **Category:** bug **Summary:** `landing_reopen_stranded_closes` (#283 reconcile) mis-classifies a no-op "already-landed" close as a stranded close and reopens the ticket, driving a reopen → `ready-for-session` → re-do → no-op-land → reopen loop. **Current behavior:** The reconcile decides "stranded" purely from the attempt record's claimed commit SHAs: for an `outcome=success` line, if **any** claimed commit is not an ancestor of `origin/main`, it reopens the (closed) issue, relabels `ready-for-session`, and comments. When a worker re-works a ticket whose fix is **already byte-identically on `main` under a different SHA**, the re-attempt's own commits are legitimately absent from `main` (its "land" was a correct no-op push). The ancestry test therefore fails on commits that represent *nothing new*, so an already-satisfied ticket is reopened. This is distinct from a genuine stranded close (commits exist on a branch but never reached `main`): both present to the reconcile as "no-op push to main," but only one lost work. **Desired behavior:** An attempt that produced **nothing not already on `main`** must be a no-op for the reconcile, not a reopen. A genuinely stranded close (its commits exist off-`main` and carry a real diff that never landed) must still reopen exactly as today. The agent chooses the discriminating signal; candidates that fit the observed case: - the attempt's claimed commits are **unreachable/non-existent** in the repo (cannot be "stranded on a branch" if they do not exist), versus existing-but-not-on-`main`; and/or - the run's parked rescue branch has an **empty diff against `origin/main`** (nothing to strand). Pick the signal that cleanly separates the two cases and is checkable from what the reconcile already has (the attempts file, `git`, the rescue branch ref) without new tracker round-trips where avoidable. **Key interfaces:** - `landing_reopen_stranded_closes <attempts-file> <repo-slug> [main-ref]` in `landing-lib.sh` — add the guard so an empty-diff / already-landed attempt skips the reopen while a real stranded close still reopens. - Keep the existing safety ordering intact: the ancestry guard, the "only reopen a currently-closed issue" check, `landing_drop_run_claims`, relabel + comment. - Comment copy, if the issue is a real stranded close, is unchanged; the guard only adds a *skip* branch. **Acceptance criteria:** - [ ] A success attempt whose fix is already on `main` (its claimed commits non-existent / empty diff vs `origin/main`) is **not** reopened and echoes nothing — a new case in `tests/landing-lib-test.sh`. - [ ] A genuinely stranded close (commits exist off-`main`, real diff, issue closed) is **still** reopened + relabelled + commented + echoed, exactly as the existing `#283` tests assert. - [ ] The existing `#283` / `#2119` / `#366` reopen tests still pass unchanged. - [ ] `landing-lib.sh` change ships with its test in the same commit; the offline suite (`tests/landing-lib-test.sh`) is green. **Out of scope:** - The separate open question of **why a closed, already-landed #52 was re-worked at all on 2026-11-19** (stale fleet-pick, maxIterations batch, replay against a stale `.sandcastle` copy). That needs forensics on the run log that parked `rescue-20261119-193223` — file it as a follow-up if confirmed; it does not block this guard, which is correct regardless of the trigger. - Manually re-closing #52 (a human/session will reconcile that ticket's state separately; it is already `ready-for-session`). - Any change to the success-path counterpart `landing_promote_landed` beyond what symmetry with the new guard strictly requires.
Author
Member

swarm-claim host=bens-mac-04 run=28950
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=28950 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #372 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #372 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #372 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261119210832-2140478 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 372,
  "status": "success",
  "commits": [
    "697a7837a2f0c893a130279d22f1aa557c8ae7c2"
  ],
  "changed_files": [
    "docs/GOTCHAS.md",
    "docs/gotchas/372-reconcile-reopens-an-already-landed-ticket.md",
    "docs/journal/2026-11-19-372.md",
    "landing-lib.sh",
    "tests/landing-lib-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A success attempt whose fix is already on main (claimed commits non-existent / empty diff vs origin/main) is NOT reopened and echoes nothing — new case in tests/landing-lib-test.sh": "landing-lib.sh: the stranded loop now skips a commit that fails `git cat-file -e` (non-existent) or passes `git diff --quiet` (empty diff vs main); tests/landing-lib-test.sh adds '#372 a close whose claimed commit no longer exists is NOT reopened' and '#372 a close whose commit has an empty diff vs main is NOT reopened', both asserting no PATCH and empty echo. 184 passed.",
    "A genuinely stranded close (commits exist off-main, real diff, issue closed) is STILL reopened + relabelled + commented + echoed, exactly as today": "tests/landing-lib-test.sh '#372 a genuinely stranded close (exists + real diff) still reopens' (CATFILE_RC=0, DIFF_QUIET_RC=1) asserts the PATCH and '444 reopened' echo; the existing default #283 stranded test is unchanged and green.",
    "The existing #283 / #2119 / #366 reopen tests still pass unchanged": "No existing #283/#2119/#366 assertion edited; git shim defaults (CATFILE_RC=0 exists, DIFF_QUIET_RC=1 real diff) keep them reopening. Full tests/landing-lib-test.sh: 184 passed, 0 failed.",
    "landing-lib.sh change ships with its test in the same commit; the offline suite (tests/landing-lib-test.sh) is green": "Commit 697a783 contains landing-lib.sh + tests/landing-lib-test.sh together; bash tests/landing-lib-test.sh exits 0 (184 passed)."
  },
  "summary": "Guarded landing_reopen_stranded_closes so a re-worked already-landed close (non-existent or empty-diff commit) skips the reopen while a genuinely stranded close still reopens, closing the spurious #52 reopen loop.",
  "blockers": []
}
**close-report** for #372 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261119210832-2140478` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 372, "status": "success", "commits": [ "697a7837a2f0c893a130279d22f1aa557c8ae7c2" ], "changed_files": [ "docs/GOTCHAS.md", "docs/gotchas/372-reconcile-reopens-an-already-landed-ticket.md", "docs/journal/2026-11-19-372.md", "landing-lib.sh", "tests/landing-lib-test.sh" ], "tests": [ { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/vendor-manifest-coverage-test.sh", "exit_code": 0 } ], "criteria": { "A success attempt whose fix is already on main (claimed commits non-existent / empty diff vs origin/main) is NOT reopened and echoes nothing — new case in tests/landing-lib-test.sh": "landing-lib.sh: the stranded loop now skips a commit that fails `git cat-file -e` (non-existent) or passes `git diff --quiet` (empty diff vs main); tests/landing-lib-test.sh adds '#372 a close whose claimed commit no longer exists is NOT reopened' and '#372 a close whose commit has an empty diff vs main is NOT reopened', both asserting no PATCH and empty echo. 184 passed.", "A genuinely stranded close (commits exist off-main, real diff, issue closed) is STILL reopened + relabelled + commented + echoed, exactly as today": "tests/landing-lib-test.sh '#372 a genuinely stranded close (exists + real diff) still reopens' (CATFILE_RC=0, DIFF_QUIET_RC=1) asserts the PATCH and '444 reopened' echo; the existing default #283 stranded test is unchanged and green.", "The existing #283 / #2119 / #366 reopen tests still pass unchanged": "No existing #283/#2119/#366 assertion edited; git shim defaults (CATFILE_RC=0 exists, DIFF_QUIET_RC=1 real diff) keep them reopening. Full tests/landing-lib-test.sh: 184 passed, 0 failed.", "landing-lib.sh change ships with its test in the same commit; the offline suite (tests/landing-lib-test.sh) is green": "Commit 697a783 contains landing-lib.sh + tests/landing-lib-test.sh together; bash tests/landing-lib-test.sh exits 0 (184 passed)." }, "summary": "Guarded landing_reopen_stranded_closes so a re-worked already-landed close (non-existent or empty-diff commit) skips the reopen while a genuinely stranded close still reopens, closing the spurious #52 reopen loop.", "blockers": [] } ``` </details>
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#372
No description provided.