swarm landing: the #207 rebase-conflict resolver has never run — --allowedTools swallows its prompt, and the argv error is classified as a failed merge so every conflict parks and pages #364

Closed
opened 2026-11-19 15:24:30 +00:00 by matou-build-agent · 4 comments

Symptom

Every rebase conflict in landing_push_main_with_rescue parks on a
sandcastle/rescue-<ts> branch and pages, reopening the already-closed ticket.
The #207 / GOTCHAS 66 resolver that is supposed to merge the conflict has
never run
— not once, on any consumer.

Three parks on Matou/dev-factory in 30 minutes on 2026-11-19:

rescue branch parked commit
sandcastle/rescue-20261119-144907 190233a
sandcastle/rescue-20261119-150929 190233a (same commit, parked twice)
sandcastle/rescue-20261119-151259 dcb3512 (#359's work; run 28842)

Root cause — the CLI rejects the resolver's argv

landing_resolve_rebase_with_claude (landing-lib.sh:492) passes the prompt as
a trailing positional argument after --allowedTools:

timeout 900 claude -p --model "$SWARM_MODEL" \
  --permission-mode acceptEdits --allowedTools "$LANDING_RESOLVE_ALLOWED_TOOLS" \
  "This git checkout is mid-rebase with conflicts. ..."

--allowedTools is variadic: it swallows the tool list and the prompt, so
the CLI sees no prompt and exits in ~0.85 s. Probed on bens-mac-04 with the
exact argv:

Error: Input must be provided either through stdin or as a prompt argument when using --print

Moving the prompt ahead of --allowedTools makes the CLI accept it (it then
reaches auth). That one reordering is the whole mechanism.

Then the classifier mislabels it. landing_resolve_classified only special-cases
limit and auth; CLAUDE_LIMIT_RE / CLAUDE_AUTH_LINE_RE do not match an argv
usage error, so a resolver that never started is reported as failed — "a
genuine red" — and the ladder parks + pages instead of deferring.

Evidence from run 28842 (/tmp/matou-heal-Matou-dev-factory.6pykrg)

  • job-log.txt: conflict at 15:12:58.18 (CONFLICT (content): Merge conflict in STATUS.md), and the rescue branch is named rescue-20261119-151259 — generated at 15:12:59. Under 1 s for a timeout 900 call: no model call happened.
  • run-verdict.txt: stage=reconcile push to main, exit=1, reason=push-parked-on-rescue — the park ladder, not rebase-rescue-limit-parked. So it was not classified as auth/limit, which rules auth out and confirms the argv error.
  • run-swarm.sh:417 calls claude_select_token before landing_stage (:493), so the stage did have a token.
  • Resolve region is byte-identical in root and .sandcastle/ (FACTORY_REF=de5ebb8), so the running copy carries it too.

Why the test suite is green

tests/run-swarm-landing-test.sh case 6 runs under PATH="$tmp/bin:/usr/bin:/bin"
with no claude in $tmp/bin, so command -v claude fails and the resolver
returns 1 before the invocation. The test asserts the park — the fallback — and
never exercises the resolver's argv. GOTCHAS #314's shape inverted: green where
written, dead where it matters.

The conflict itself was legitimate (not a #287 breach)

Worker dcb3512 inserted a new #359 bullet between the #353 and #351
bullets; concurrently 75ecff9 on main rewrote the #353 bullet, deleted
the #351 bullet and inserted #360. Both of the insert's anchor lines were
rewritten, so a line-based 3-way merge cannot resolve it. The "writers touch
different rows" discipline held — STATUS.md is a single contiguous bullet list,
so adjacency still collides. .gitattributes deliberately excludes STATUS.md
from merge=union and that reasoning is still right. This is exactly the case
the resolver exists to absorb.

Scope — more than the one-line reorder

  1. landing-lib.sh:492 — put the prompt before --allowedTools (or feed it
    on stdin). One-line, mechanical.
  2. landing_resolve_classified needs an unusable class: a resolver that
    could not start (claude absent, argv rejected, bad --model) is not a failed
    merge. It should defer quietly like refused, not page as a red. Detect it
    positively (empty log / usage-error signature / rebase never advanced), keeping
    the #346 "positive-only, default preserves the ladder" discipline.
  3. LANDING_TEST_CMD is unset everywhere in this repo (swarm-identity.sh,
    swarm-policy.sh, onboarding/). landing_run_pinned_tests fails closed when
    unset, so even with 1 fixed, a resolved conflict still parks —
    rebase-resolved-red-parked instead of push-parked-on-rescue. To actually
    absorb conflicts this repo must declare the command in its identity layer.
  4. Test against a stub claude on PATH that validates its argv and
    advances the rebase, so the invocation can never silently die again. Keep
    case 6 (claude-absent → park) as a separate case.

Decision a human owns

Fixing 1 activates a path that has never executed in production: a headless
Claude merging on the branch everything pulls from. The ladder gates it
(re-test, then PR, never a direct push to main — GOTCHAS 66), but it is still
an activation, and it reaches every consumer at its next FACTORY_REF bump. The
healer charter classes root *.sh as product and did not touch it. A root fix
does not reach the running .sandcastle/ copy until a human re-vendors
(onboarding/onboard.sh vendor .sandcastle <sha>, GOTCHAS 4).

Not lost

#359 is reopened and ready-for-session, so it retries; 190233a reached
main on a later run. The ladder's safety behaviour is correct — only its
alarm/deferral classification and the dead resolver are wrong.

Filed by the swarm healer from run 28842 (signature e9d7ba086503).

## Symptom Every rebase conflict in `landing_push_main_with_rescue` parks on a `sandcastle/rescue-<ts>` branch and pages, reopening the already-closed ticket. The #207 / GOTCHAS 66 resolver that is supposed to merge the conflict **has never run** — not once, on any consumer. Three parks on `Matou/dev-factory` in 30 minutes on 2026-11-19: | rescue branch | parked commit | |---|---| | `sandcastle/rescue-20261119-144907` | `190233a` | | `sandcastle/rescue-20261119-150929` | `190233a` (same commit, parked twice) | | `sandcastle/rescue-20261119-151259` | `dcb3512` (#359's work; run 28842) | ## Root cause — the CLI rejects the resolver's argv `landing_resolve_rebase_with_claude` (`landing-lib.sh:492`) passes the prompt as a **trailing positional argument after `--allowedTools`**: ``` timeout 900 claude -p --model "$SWARM_MODEL" \ --permission-mode acceptEdits --allowedTools "$LANDING_RESOLVE_ALLOWED_TOOLS" \ "This git checkout is mid-rebase with conflicts. ..." ``` `--allowedTools` is **variadic**: it swallows the tool list *and* the prompt, so the CLI sees no prompt and exits in ~0.85 s. Probed on `bens-mac-04` with the exact argv: ``` Error: Input must be provided either through stdin or as a prompt argument when using --print ``` Moving the prompt ahead of `--allowedTools` makes the CLI accept it (it then reaches auth). That one reordering is the whole mechanism. Then the classifier mislabels it. `landing_resolve_classified` only special-cases limit and auth; `CLAUDE_LIMIT_RE` / `CLAUDE_AUTH_LINE_RE` do not match an argv usage error, so a resolver that **never started** is reported as `failed` — "a genuine red" — and the ladder parks + pages instead of deferring. ### Evidence from run 28842 (`/tmp/matou-heal-Matou-dev-factory.6pykrg`) - `job-log.txt`: conflict at `15:12:58.18` (`CONFLICT (content): Merge conflict in STATUS.md`), and the rescue branch is named `rescue-20261119-151259` — generated at **15:12:59**. Under 1 s for a `timeout 900` call: no model call happened. - `run-verdict.txt`: `stage=reconcile push to main`, `exit=1`, `reason=push-parked-on-rescue` — the park ladder, **not** `rebase-rescue-limit-parked`. So it was not classified as auth/limit, which rules auth out and confirms the argv error. - `run-swarm.sh:417` calls `claude_select_token` before `landing_stage` (`:493`), so the stage did have a token. - Resolve region is byte-identical in root and `.sandcastle/` (`FACTORY_REF=de5ebb8`), so the running copy carries it too. ## Why the test suite is green `tests/run-swarm-landing-test.sh` case 6 runs under `PATH="$tmp/bin:/usr/bin:/bin"` with **no `claude` in `$tmp/bin`**, so `command -v claude` fails and the resolver returns 1 before the invocation. The test asserts the *park* — the fallback — and never exercises the resolver's argv. GOTCHAS #314's shape inverted: green where written, dead where it matters. ## The conflict itself was legitimate (not a #287 breach) Worker `dcb3512` inserted a new `#359` bullet between the `#353` and `#351` bullets; concurrently `75ecff9` on `main` rewrote the `#353` bullet, **deleted** the `#351` bullet and inserted `#360`. Both of the insert's anchor lines were rewritten, so a line-based 3-way merge cannot resolve it. The "writers touch different rows" discipline held — `STATUS.md` is a single contiguous bullet list, so adjacency still collides. `.gitattributes` deliberately excludes `STATUS.md` from `merge=union` and that reasoning is still right. This is exactly the case the resolver exists to absorb. ## Scope — more than the one-line reorder 1. **`landing-lib.sh:492`** — put the prompt before `--allowedTools` (or feed it on stdin). One-line, mechanical. 2. **`landing_resolve_classified`** needs an `unusable` class: a resolver that could not start (claude absent, argv rejected, bad `--model`) is not a failed merge. It should defer quietly like `refused`, not page as a red. Detect it positively (empty log / usage-error signature / rebase never advanced), keeping the #346 "positive-only, default preserves the ladder" discipline. 3. **`LANDING_TEST_CMD` is unset everywhere** in this repo (`swarm-identity.sh`, `swarm-policy.sh`, `onboarding/`). `landing_run_pinned_tests` fails closed when unset, so even with 1 fixed, a resolved conflict still parks — `rebase-resolved-red-parked` instead of `push-parked-on-rescue`. To actually absorb conflicts this repo must declare the command in its identity layer. 4. **Test** against a stub `claude` on `PATH` that *validates its argv* and advances the rebase, so the invocation can never silently die again. Keep case 6 (claude-absent → park) as a separate case. ## Decision a human owns Fixing 1 activates a path that has **never executed in production**: a headless Claude merging on the branch everything pulls from. The ladder gates it (re-test, then PR, never a direct push to `main` — GOTCHAS 66), but it is still an activation, and it reaches every consumer at its next `FACTORY_REF` bump. The healer charter classes root `*.sh` as product and did not touch it. A root fix does not reach the running `.sandcastle/` copy until a human re-vendors (`onboarding/onboard.sh vendor .sandcastle <sha>`, GOTCHAS 4). ## Not lost `#359` is reopened and `ready-for-session`, so it retries; `190233a` reached `main` on a later run. The ladder's safety behaviour is correct — only its alarm/deferral classification and the dead resolver are wrong. Filed by the swarm healer from run 28842 (signature `e9d7ba086503`).
Author
Member

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

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

Ruled by agent under ADR 0174 — veto anytime.

Decision. The ticket flags that fixing step 1 activates a path that has never executed in production — a headless Claude resolving a rebase conflict on the branch everything pulls from — and asks whether a human must own that. I rule this a two-way door and proceed with all four scope items (argv reorder, the unusable classification, the LANDING_TEST_CMD declaration, and the stub-claude argv test).

Why it is a two-way door.

  • Reversible. All three code changes are plain reverts (an argv reorder, a classifier branch, one identity-layer assignment). No data is destroyed on any path — a bad resolution parks on a sandcastle/rescue-* branch (preserved), and the allowlist + prompt forbid --abort, force-push and content deletion.
  • No security-posture widening. The resolver still runs under the SAME bounded --allowedTools allowlist #207/GOTCHAS 66 defined (no new tools, no --dangerously-skip-permissions). The resolved HEAD is never pushed to main: it is re-tested on LANDING_TEST_CMD and routed to a rescue PR for human review, or parked red + paged. This fixes a bug that stopped the already-approved path from running; it does not loosen what that path may do. Not a one-way-door category (no personal credentials, trust accept, data destruction, or non-routine spend — the resolver is a bounded timeout 900 claude per conflict).
  • The human keeps the real activation lever. A root landing-lib.sh change does not reach the running .sandcastle/ self-copy or any consumer until a human re-vendors (onboard.sh vendor .sandcastle <sha>, GOTCHAS 4). So this commit changes nothing in production until that re-vendor; and even once live, nothing a conflict resolver produced reaches main without a passing pinned-test run and a human-reviewed PR.

What proves it. tests/landing-lib-test.sh drives the real resolver against a stub claude that parses its own argv like the CLI (a prompt after --allowedTools is swallowed → usage error), so a revert to the trailing-positional order reds the suite; plus unit coverage of the unusable verdict, claude-absent → quiet defer, and landing_run_pinned_tests fail-closed. tests/run-swarm-landing-test.sh proves the landing_stage wiring (park ladder resolver-free; claude-absent defers). tests/swarm-identity-test.sh guards the LANDING_TEST_CMD declaration. The re-test→rescue-PR gate itself is already proven green (#207 suite). Veto anytime by reverting the commit or holding the re-vendor.

**Ruled by agent under ADR 0174 — veto anytime.** **Decision.** The ticket flags that fixing step 1 *activates* a path that has never executed in production — a headless Claude resolving a rebase conflict on the branch everything pulls from — and asks whether a human must own that. I rule this a **two-way door** and proceed with all four scope items (argv reorder, the `unusable` classification, the `LANDING_TEST_CMD` declaration, and the stub-`claude` argv test). **Why it is a two-way door.** - **Reversible.** All three code changes are plain reverts (an argv reorder, a classifier branch, one identity-layer assignment). No data is destroyed on any path — a bad resolution parks on a `sandcastle/rescue-*` branch (preserved), and the allowlist + prompt forbid `--abort`, force-push and content deletion. - **No security-posture widening.** The resolver still runs under the SAME bounded `--allowedTools` allowlist #207/GOTCHAS 66 defined (no new tools, no `--dangerously-skip-permissions`). The resolved HEAD is **never** pushed to `main`: it is re-tested on `LANDING_TEST_CMD` and routed to a rescue PR for human review, or parked red + paged. This fixes a bug that stopped the already-approved path from running; it does not loosen what that path may do. Not a one-way-door category (no personal credentials, trust accept, data destruction, or non-routine spend — the resolver is a bounded `timeout 900 claude` per conflict). - **The human keeps the real activation lever.** A root `landing-lib.sh` change does not reach the running `.sandcastle/` self-copy or any consumer until a human re-vendors (`onboard.sh vendor .sandcastle <sha>`, GOTCHAS 4). So this commit changes nothing in production until that re-vendor; and even once live, nothing a conflict resolver produced reaches `main` without a passing pinned-test run and a human-reviewed PR. **What proves it.** `tests/landing-lib-test.sh` drives the real resolver against a stub `claude` that parses its own argv like the CLI (a prompt after `--allowedTools` is swallowed → usage error), so a revert to the trailing-positional order reds the suite; plus unit coverage of the `unusable` verdict, claude-absent → quiet defer, and `landing_run_pinned_tests` fail-closed. `tests/run-swarm-landing-test.sh` proves the `landing_stage` wiring (park ladder resolver-free; claude-absent defers). `tests/swarm-identity-test.sh` guards the `LANDING_TEST_CMD` declaration. The re-test→rescue-PR gate itself is already proven green (#207 suite). Veto anytime by reverting the commit or holding the re-vendor.
Author
Member

⏩ independent reviewer for #364 — verdict unauthenticated

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

close-report for #364 — status success

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

envelope
{
  "issue": 364,
  "status": "success",
  "commits": [
    "0039f66e8b77c43e12e2b95c44cef5ccf28808ab"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/gotchas/66-a-rebase-conflict-resolved-by-a-headless.md",
    "docs/journal/2026-11-19-364.md",
    "landing-lib.sh",
    "swarm-identity.sh",
    "tests/landing-lib-test.sh",
    "tests/run-swarm-landing-test.sh",
    "tests/swarm-identity-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/run-swarm-landing-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/swarm-identity-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "1. landing-lib.sh:492 — prompt before --allowedTools (or stdin)": "landing-lib.sh: landing_resolve_rebase_with_claude now passes the prompt as the LEADING positional (local prompt; `claude -p \"$prompt\" ... --allowedTools \"$...\"` LAST). Proven by tests/landing-lib-test.sh '#364 the prompt reaches claude BEFORE --allowedTools (not swallowed)' + the stub that rejects a swallowed prompt.",
    "2. landing_resolve_classified needs an `unusable` class (positive-only, defers quietly, not a page)": "landing-lib.sh: added LANDING_RESOLVE_UNUSABLE_RE + landing_resolve_unusable, and a fourth `unusable` verdict (claude absent / usage-error / bad-model / empty-log-mid-flight); the ladder in landing_push_main_with_rescue defers quietly (reason rebase-rescue-resolver-unusable, hourglass not rotating_light). Proven by tests/landing-lib-test.sh unusable unit cases + claude-absent defer, and run-swarm-landing case 6b.",
    "3. LANDING_TEST_CMD declared in this repo's identity layer": "swarm-identity.sh declares LANDING_TEST_CMD (dev-factory's own offline suite, fail-on-first-red), if-unset so an operator override wins. Guarded by tests/swarm-identity-test.sh group 8.",
    "4. Test against a stub claude that validates its argv and advances the rebase; keep a claude-absent case": "tests/landing-lib-test.sh: a stub claude parses its own argv like the CLI (prompt after --allowedTools => usage error, exit 1) and only resolves on a valid invocation; run-swarm-landing case 6 repointed to a resolver-free park (clean rebase), case 6b added for claude-absent → quiet defer."
  },
  "summary": "Fixed the #207 rebase resolver's swallowed-prompt argv so it actually runs, added an `unusable` quiet-defer verdict for a could-not-start resolver, and declared LANDING_TEST_CMD so a resolved conflict can re-test instead of fail-closed parking.",
  "blockers": []
}
**close-report** for #364 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261119152654-1251003` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 364, "status": "success", "commits": [ "0039f66e8b77c43e12e2b95c44cef5ccf28808ab" ], "changed_files": [ "STATUS.md", "docs/gotchas/66-a-rebase-conflict-resolved-by-a-headless.md", "docs/journal/2026-11-19-364.md", "landing-lib.sh", "swarm-identity.sh", "tests/landing-lib-test.sh", "tests/run-swarm-landing-test.sh", "tests/swarm-identity-test.sh" ], "tests": [ { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/run-swarm-landing-test.sh", "exit_code": 0 }, { "command": "bash tests/swarm-identity-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 } ], "criteria": { "1. landing-lib.sh:492 — prompt before --allowedTools (or stdin)": "landing-lib.sh: landing_resolve_rebase_with_claude now passes the prompt as the LEADING positional (local prompt; `claude -p \"$prompt\" ... --allowedTools \"$...\"` LAST). Proven by tests/landing-lib-test.sh '#364 the prompt reaches claude BEFORE --allowedTools (not swallowed)' + the stub that rejects a swallowed prompt.", "2. landing_resolve_classified needs an `unusable` class (positive-only, defers quietly, not a page)": "landing-lib.sh: added LANDING_RESOLVE_UNUSABLE_RE + landing_resolve_unusable, and a fourth `unusable` verdict (claude absent / usage-error / bad-model / empty-log-mid-flight); the ladder in landing_push_main_with_rescue defers quietly (reason rebase-rescue-resolver-unusable, hourglass not rotating_light). Proven by tests/landing-lib-test.sh unusable unit cases + claude-absent defer, and run-swarm-landing case 6b.", "3. LANDING_TEST_CMD declared in this repo's identity layer": "swarm-identity.sh declares LANDING_TEST_CMD (dev-factory's own offline suite, fail-on-first-red), if-unset so an operator override wins. Guarded by tests/swarm-identity-test.sh group 8.", "4. Test against a stub claude that validates its argv and advances the rebase; keep a claude-absent case": "tests/landing-lib-test.sh: a stub claude parses its own argv like the CLI (prompt after --allowedTools => usage error, exit 1) and only resolves on a valid invocation; run-swarm-landing case 6 repointed to a resolver-free park (clean rebase), case 6b added for claude-absent → quiet defer." }, "summary": "Fixed the #207 rebase resolver's swallowed-prompt argv so it actually runs, added an `unusable` quiet-defer verdict for a could-not-start resolver, and declared LANDING_TEST_CMD so a resolved conflict can re-test instead of fail-closed parking.", "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#364
No description provided.