swarm landing: a local pre-push hook refusal is alarmed as push-rescue-unreachable (the forge was up, no rescue branch exists) #346

Closed
opened 2026-11-18 04:37:55 +00:00 by ben · 6 comments
Owner

Symptom

Two Matou/policy-generators swarm runs (182 and 205, 2026-11-18 ~03:33Z) went red at stage=reconcile push to main with reason push-rescue-unreachable. The Mattermost alarm said the forge was unreachable and pointed at a sandcastle/rescue-* branch. Both were false: the Forgejo API answered 200 in 1.24 s during the incident, and no rescue branch was ever created.

The ticket had been closed green by close-report and was reopened by the #283 reconcile, twice. A person reading the alarm goes looking for a network fault and a branch that is not there.

Cause

landing_push_main_with_rescue (.sandcastle/landing-lib.sh) treats every non-zero git push as a transport failure. Here the push never left the host: the local pre-push hook refused it (the TypeScript gate, exit 3, then exit 1 — see the consumer ticket below). The ladder then:

  1. tried git push origin HEAD:main — refused by the hook;
  2. rebased and retried — refused by the hook;
  3. tried git push origin HEAD:refs/heads/<rescue> — refused by the same hook;
  4. reported push-rescue-unreachable.

So a hook that says no also blocks the rescue push, and the ladder has no way to say "refused locally".

What to fix

  • Tell a local hook refusal from a transport failure, and give it its own exit reason and alarm text that names the hook and its output. One way: capture the push's stderr, or run the hook's check before the ladder starts.
  • Decide whether the rescue push should run the pre-push language gates at all. A rescue branch exists to park work that could not land; a gate that refuses the park leaves the commits only in the runner workdir, where the next run's reset --hard discards them. (Here they survived only because the worker had already pushed its own branch.)
  • The alarm must not claim a rescue branch exists unless the push that creates it succeeded. This is the same class as #141 (an unverified park), reached by a different road.

Evidence

The consumer-side cause (the host could not run its TS gate) is fixed in Matou/policy-generators commit 32c41cb. This ticket is about the ladder's diagnosis, which stays wrong for any future hook refusal.

Filed by a Claude session at Ben's request. I did not see the host logs myself; the run facts are the swarm healer's, from the consumer ticket.

## Symptom Two `Matou/policy-generators` swarm runs (182 and 205, 2026-11-18 ~03:33Z) went red at `stage=reconcile push to main` with reason `push-rescue-unreachable`. The Mattermost alarm said the forge was unreachable and pointed at a `sandcastle/rescue-*` branch. Both were false: the Forgejo API answered 200 in 1.24 s during the incident, and no rescue branch was ever created. The ticket had been closed green by close-report and was reopened by the #283 reconcile, twice. A person reading the alarm goes looking for a network fault and a branch that is not there. ## Cause `landing_push_main_with_rescue` (`.sandcastle/landing-lib.sh`) treats every non-zero `git push` as a transport failure. Here the push never left the host: the **local pre-push hook** refused it (the TypeScript gate, exit 3, then exit 1 — see the consumer ticket below). The ladder then: 1. tried `git push origin HEAD:main` — refused by the hook; 2. rebased and retried — refused by the hook; 3. tried `git push origin HEAD:refs/heads/<rescue>` — refused by the **same** hook; 4. reported `push-rescue-unreachable`. So a hook that says no also blocks the rescue push, and the ladder has no way to say "refused locally". ## What to fix - Tell a local hook refusal from a transport failure, and give it its own exit reason and alarm text that names the hook and its output. One way: capture the push's stderr, or run the hook's check before the ladder starts. - Decide whether the rescue push should run the pre-push language gates at all. A rescue branch exists to park work that could not land; a gate that refuses the park leaves the commits only in the runner workdir, where the next run's `reset --hard` discards them. (Here they survived only because the worker had already pushed its own branch.) - The alarm must not claim a rescue branch exists unless the push that creates it succeeded. This is the same class as #141 (an unverified park), reached by a different road. ## Evidence - Consumer ticket with the healer's full analysis and reproduction: https://git.matou.nz/Matou/policy-generators/issues/98 - Run: https://git.matou.nz/Matou/policy-generators/actions/runs/205 - Consumer pin at the time: `FACTORY_REF` `cda3470`. The consumer-side cause (the host could not run its TS gate) is fixed in `Matou/policy-generators` commit `32c41cb`. This ticket is about the ladder's diagnosis, which stays wrong for any future hook refusal. Filed by a Claude session at Ben's request. I did not see the host logs myself; the run facts are the swarm healer's, from the consumer ticket.

This was generated by AI during triage.

Triage: bug → ready-for-agent

Verified against the code at main. landing_push_main_with_rescue (landing-lib.sh) runs an unconditional ladder: git push origin HEAD:main, fetch+rebase+retry, then a rescue push git push origin HEAD:refs/heads/sandcastle/rescue-<ts>. A local pre-push hook refuses all three identically to a transport failure; because the rescue push is refused by the same hook, the ladder lands on its deepest branch and sets SWARM_EXIT_REASON="push-rescue-unreachable" with the alarm "the forge is unreachable, so <rescue> does NOT exist." Both are false when the forge was up and the hook was the refuser — exactly the reported incident. Claim confirmed; not already fixed (the ladder has no hook-vs-transport distinction today).

One embedded design question — should the rescue push run the pre-push language gates at all? — is a two-way door (revertible, test-provable). The implementing agent should rule it under ADR 0174 and record the choice; this brief does not pre-decide it.

Agent Brief

Category: bug
Summary: The push ladder reports a local pre-push hook refusal as push-rescue-unreachable ("forge unreachable", nonexistent rescue branch).

Current behavior:
The push-mode landing ladder treats every non-zero git push as a transport failure. When a local pre-push hook refuses the push, the ladder retries, then attempts a rescue-branch push which the same hook also refuses, and finally alarms that the forge is unreachable and that a rescue branch exists — neither true. The operator is sent looking for a network fault and a branch that was never created.

Desired behavior:

  • A local hook refusal is distinguished from a transport failure and gets its own exit reason and alarm text that names the hook and surfaces its output (e.g. the push's captured stderr).
  • An alarm never claims a rescue branch exists unless the push that would create it actually succeeded (same class as the unverified-park hazard family).
  • A deliberate decision (ruled under ADR 0174) on whether the rescue/park push should be subject to the pre-push language gates, since a gate that refuses the park strands the commits where the next run's reset --hard discards them.

Key interfaces:

  • The push-mode landing ladder function that currently ends in the push-rescue-unreachable exit reason — it should classify the push outcome (hook refusal vs transport failure) rather than assuming transport.
  • The SWARM_EXIT_REASON vocabulary — add a distinct reason for a local hook refusal so the healer keys a correct signature.
  • The landing notify/alarm text helper — the hook-refusal path needs its own message; the "rescue branch does not exist / forge unreachable" wording must only fire on a genuinely attempted-and-failed transport push.

Acceptance criteria:

  • A local pre-push hook refusal produces an exit reason distinct from push-rescue-unreachable/transport reasons, and an alarm that names the hook and includes its output.
  • No alarm asserts a rescue branch exists unless that branch's push returned success.
  • A test covers the hook-refusal path (shimmed git push that fails like a hook, forge reachable) and asserts the new reason/alarm, separately from the existing transport-failure path.
  • The existing transport-failure behavior and reasons are unchanged when the push genuinely cannot reach the forge.
  • The lib change ships with its test in the same commit (repo rule).

Out of scope:

  • The consumer-side cause (the host could not run its TS gate) — already fixed in Matou/policy-generators 32c41cb.
  • The concurrent-workdir landing race — tracked separately in the sibling ticket #347.
> *This was generated by AI during triage.* ## Triage: `bug` → `ready-for-agent` Verified against the code at `main`. `landing_push_main_with_rescue` (`landing-lib.sh`) runs an unconditional ladder: `git push origin HEAD:main`, fetch+rebase+retry, then a rescue push `git push origin HEAD:refs/heads/sandcastle/rescue-<ts>`. A **local pre-push hook** refuses all three identically to a transport failure; because the rescue push is refused by the *same* hook, the ladder lands on its deepest branch and sets `SWARM_EXIT_REASON="push-rescue-unreachable"` with the alarm "the forge is unreachable, so `<rescue>` does NOT exist." Both are false when the forge was up and the hook was the refuser — exactly the reported incident. Claim confirmed; not already fixed (the ladder has no hook-vs-transport distinction today). One embedded design question — *should the rescue push run the pre-push language gates at all?* — is a two-way door (revertible, test-provable). The implementing agent should rule it under ADR 0174 and record the choice; this brief does not pre-decide it. ## Agent Brief **Category:** bug **Summary:** The push ladder reports a local pre-push hook refusal as `push-rescue-unreachable` ("forge unreachable", nonexistent rescue branch). **Current behavior:** The push-mode landing ladder treats every non-zero `git push` as a transport failure. When a local pre-push hook refuses the push, the ladder retries, then attempts a rescue-branch push which the same hook also refuses, and finally alarms that the forge is unreachable and that a rescue branch exists — neither true. The operator is sent looking for a network fault and a branch that was never created. **Desired behavior:** - A local hook refusal is distinguished from a transport failure and gets its own exit reason and alarm text that names the hook and surfaces its output (e.g. the push's captured stderr). - An alarm never claims a rescue branch exists unless the push that would create it actually succeeded (same class as the unverified-park hazard family). - A deliberate decision (ruled under ADR 0174) on whether the rescue/park push should be subject to the pre-push language gates, since a gate that refuses the park strands the commits where the next run's `reset --hard` discards them. **Key interfaces:** - The push-mode landing ladder function that currently ends in the `push-rescue-unreachable` exit reason — it should classify the push outcome (hook refusal vs transport failure) rather than assuming transport. - The `SWARM_EXIT_REASON` vocabulary — add a distinct reason for a local hook refusal so the healer keys a correct signature. - The landing notify/alarm text helper — the hook-refusal path needs its own message; the "rescue branch does not exist / forge unreachable" wording must only fire on a genuinely attempted-and-failed transport push. **Acceptance criteria:** - [ ] A local pre-push hook refusal produces an exit reason distinct from `push-rescue-unreachable`/transport reasons, and an alarm that names the hook and includes its output. - [ ] No alarm asserts a rescue branch exists unless that branch's push returned success. - [ ] A test covers the hook-refusal path (shimmed `git push` that fails like a hook, forge reachable) and asserts the new reason/alarm, separately from the existing transport-failure path. - [ ] The existing transport-failure behavior and reasons are unchanged when the push genuinely cannot reach the forge. - [ ] The lib change ships with its test in the same commit (repo rule). **Out of scope:** - The consumer-side cause (the host could not run its TS gate) — already fixed in `Matou/policy-generators` `32c41cb`. - The concurrent-workdir landing race — tracked separately in the sibling ticket #347.

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

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

⚠️ Swarm is starving. This repo's swarm has yielded 3 consecutive ticks (most recent reason: slots-busy) with 1 ready-for-agent ticket(s) still open — the host's shared heavy slots have been busy (two long drains hold both slots on every host), so no worker has claimed for them. New tickets here are waiting behind other repos' work; this repo has now declared a want-file so a peer's queue-draining run frees its slot after the current ticket. A human may want to check host capacity.

Ruled by agent under ADR 0174 — veto anytime. Automated starvation signal (Matou/dev-factory #213): posted once per episode, cleared on the next real claim.

⚠️ **Swarm is starving.** This repo's swarm has yielded **3 consecutive ticks** (most recent reason: `slots-busy`) with **1** ready-for-agent ticket(s) still open — the host's shared heavy slots have been busy (two long drains hold both slots on every host), so no worker has claimed for them. New tickets here are waiting behind other repos' work; this repo has now declared a want-file so a peer's queue-draining run frees its slot after the current ticket. A human may want to check host capacity. Ruled by agent under ADR 0174 — veto anytime. Automated starvation signal (Matou/dev-factory #213): posted once per episode, cleared on the next real claim.

Ruled by agent under ADR 0174 — veto anytime.

Decision (the one embedded in this ticket): should the rescue/park push run the consumer's pre-push language gates? No — the park bypasses them (git push --no-verify).

Ruling. A rescue branch exists to preserve work that could not land, and it never auto-lands — a human re-reviews before anything on it reaches main. A pre-push language gate that refuses the park therefore buys no safety (nothing lands unreviewed) and costs the whole point of the park: the commits are left only in the runner workdir, where the next run's reset --hard discards them. So the park in the new landing_park_hook_refusal pushes the rescue branch with --no-verify.

Why it is a two-way door. Revertible by a single commit (drop --no-verify), and it widens nothing a human can't see: the rescue branch is quarantine, not a landing, and the review gate that matters (a human merging/cherry-picking onto main) is untouched. It is not on the one-way-door list (no credentials, no security-posture widening, no data destruction — it prevents destruction).

What proves it. The offline test tests/landing-lib-test.sh (#346 block) asserts the hook-refusal park reaches the rescue branch with --no-verify and the commits survive, separately from the transport path. Veto anytime.

Ruled by agent under ADR 0174 — veto anytime. **Decision (the one embedded in this ticket):** should the rescue/park push run the consumer's pre-push language gates? **No — the park bypasses them (`git push --no-verify`).** **Ruling.** A rescue branch exists to *preserve* work that could not land, and it never auto-lands — a human re-reviews before anything on it reaches `main`. A pre-push language gate that refuses the park therefore buys no safety (nothing lands unreviewed) and costs the whole point of the park: the commits are left only in the runner workdir, where the next run's `reset --hard` discards them. So the park in the new `landing_park_hook_refusal` pushes the rescue branch with `--no-verify`. **Why it is a two-way door.** Revertible by a single commit (drop `--no-verify`), and it widens nothing a human can't see: the rescue branch is quarantine, not a landing, and the review gate that matters (a human merging/cherry-picking onto `main`) is untouched. It is not on the one-way-door list (no credentials, no security-posture widening, no data destruction — it *prevents* destruction). **What proves it.** The offline test `tests/landing-lib-test.sh` (`#346` block) asserts the hook-refusal park reaches the rescue branch with `--no-verify` and the commits survive, separately from the transport path. Veto anytime.

⏩ independent reviewer for #346 — verdict unauthenticated

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

close-report for #346 — status success

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

envelope
{
  "issue": 346,
  "status": "success",
  "commits": [
    "34a97ece0f9325a63da59593f288f600131e6e51"
  ],
  "changed_files": [
    "landing-lib.sh",
    "tests/landing-lib-test.sh",
    "docs/GOTCHAS.md",
    "docs/gotchas/346-hook-refusal-alarmed-as-push-rescue-unreachable.md",
    "docs/journal/2026-11-18-346.md"
  ],
  "tests": [
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A local pre-push hook refusal produces an exit reason distinct from push-rescue-unreachable/transport reasons, and an alarm that names the hook and includes its output": "landing-lib.sh landing_park_hook_refusal sets SWARM_EXIT_REASON=push-refused-by-local-hook (and -rescue-unreachable on a failed park) and alarms 'LOCAL pre-push hook' with the captured hook output in a code fence; tests/landing-lib-test.sh #346 asserts the reason, 'LOCAL pre-push hook', 'forge was reachable', and the hook's 'TypeScript gate failed' output",
    "No alarm asserts a rescue branch exists unless that branch's push returned success": "landing_park_hook_refusal claims 'parked on <rescue>' only in the success branch of the --no-verify push; the failure branch says the commits are ONLY in the runner workdir; tests assert the failed-park alarm contains 'ONLY in the runner workdir' and not a branch-parked claim",
    "A test covers the hook-refusal path (shimmed git push that fails like a hook, forge reachable) and asserts the new reason/alarm, separately from the existing transport-failure path": "tests/landing-lib-test.sh gains the MAIN_PUSH_STDERR shim knob and a #346 block: 6 classifier cases + a hook-refusal integration path + the failed-park reason + a separate genuine-transport case asserting push-rescue-unreachable",
    "The existing transport-failure behavior and reasons are unchanged when the push genuinely cannot reach the forge": "landing_classify_push_failure returns transport for transport fatals and defaults empty/unknown to rejected (POSITIVE-only hook verdict), so transport/stale failures fall through to the unchanged fetch+rebase+rescue ladder; test '#346 a transport failure still reaches the transport reason (push-rescue-unreachable)' proves it, and all pre-existing #207 ladder tests still pass",
    "The lib change ships with its test in the same commit (repo rule)": "commit 34a97ece0f9325a63da59593f288f600131e6e51 changes both landing-lib.sh and tests/landing-lib-test.sh"
  },
  "summary": "Classify a failed git push (local hook refusal vs transport vs stale main) so a pre-push hook refusal is parked with the hook bypassed and alarmed honestly, never as push-rescue-unreachable.",
  "blockers": []
}
**close-report** for #346 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261118-000033-5f0b74` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 346, "status": "success", "commits": [ "34a97ece0f9325a63da59593f288f600131e6e51" ], "changed_files": [ "landing-lib.sh", "tests/landing-lib-test.sh", "docs/GOTCHAS.md", "docs/gotchas/346-hook-refusal-alarmed-as-push-rescue-unreachable.md", "docs/journal/2026-11-18-346.md" ], "tests": [ { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 } ], "criteria": { "A local pre-push hook refusal produces an exit reason distinct from push-rescue-unreachable/transport reasons, and an alarm that names the hook and includes its output": "landing-lib.sh landing_park_hook_refusal sets SWARM_EXIT_REASON=push-refused-by-local-hook (and -rescue-unreachable on a failed park) and alarms 'LOCAL pre-push hook' with the captured hook output in a code fence; tests/landing-lib-test.sh #346 asserts the reason, 'LOCAL pre-push hook', 'forge was reachable', and the hook's 'TypeScript gate failed' output", "No alarm asserts a rescue branch exists unless that branch's push returned success": "landing_park_hook_refusal claims 'parked on <rescue>' only in the success branch of the --no-verify push; the failure branch says the commits are ONLY in the runner workdir; tests assert the failed-park alarm contains 'ONLY in the runner workdir' and not a branch-parked claim", "A test covers the hook-refusal path (shimmed git push that fails like a hook, forge reachable) and asserts the new reason/alarm, separately from the existing transport-failure path": "tests/landing-lib-test.sh gains the MAIN_PUSH_STDERR shim knob and a #346 block: 6 classifier cases + a hook-refusal integration path + the failed-park reason + a separate genuine-transport case asserting push-rescue-unreachable", "The existing transport-failure behavior and reasons are unchanged when the push genuinely cannot reach the forge": "landing_classify_push_failure returns transport for transport fatals and defaults empty/unknown to rejected (POSITIVE-only hook verdict), so transport/stale failures fall through to the unchanged fetch+rebase+rescue ladder; test '#346 a transport failure still reaches the transport reason (push-rescue-unreachable)' proves it, and all pre-existing #207 ladder tests still pass", "The lib change ships with its test in the same commit (repo rule)": "commit 34a97ece0f9325a63da59593f288f600131e6e51 changes both landing-lib.sh and tests/landing-lib-test.sh" }, "summary": "Classify a failed git push (local hook refusal vs transport vs stale main) so a pre-push hook refusal is parked with the hook bypassed and alarmed honestly, never as push-rescue-unreachable.", "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#346
No description provided.