claim-next-task-test's push-mode scenario inherits the CONSUMER's swarm-policy.sh — red in every LANDING=pr repo (coa, matou-app, pregnancy-navigator) at any pin #186

Closed
opened 2026-09-24 05:02:10 +00:00 by ben · 3 comments
Owner

Symptom: running the vendored .sandcastle/tests/claim-next-task-test.sh inside a LANDING=pr consumer (coa, matou-app, pregnancy-navigator) fails ONE scenario — FAIL: push-mode landing line printed on stderr (pass=43 fail=1) — at the OLD pin (a553c00) and the new one (db2e305) alike. Seen 2026-09-24 while bumping the four consumers for GOTCHAS 62. The push-mode consumers (idss, matou-website, dev-factory itself) pass 44/44.

Cause: the T2b scenario (#13) pins SWARM_POLICY_FILE to a fake LANDING=pr policy, but the push-mode scenario before it does NOT pin the seam, so claim-next-task.sh sources the consumer's real .sandcastle/swarm-policy.sh and prints the PR-branch landing line instead of the push one. Proof: SWARM_POLICY_FILE=<empty file> bash .sandcastle/tests/claim-next-task-test.sh → pass=44 fail=0 in coa.

Rule to land: every vendored test that exercises a policy-dependent seam must pin SWARM_POLICY_FILE (or the equivalent seam) in EVERY scenario, never inherit the host repo's declaration — a vendored test is run from six repos with three different policies. Worth a sweep of the other tests for the same shape (grep -L SWARM_POLICY_FILE over tests that source policy-lib), and a GOTCHAS entry.

Found during the GOTCHAS 62 consumer bumps (coa #147, matou-app #608, pregnancy-navigator #47, matou-website #13); those PRs ran the test with the seam pinned.

**Symptom:** running the vendored `.sandcastle/tests/claim-next-task-test.sh` inside a `LANDING=pr` consumer (coa, matou-app, pregnancy-navigator) fails ONE scenario — `FAIL: push-mode landing line printed on stderr` (`pass=43 fail=1`) — at the OLD pin (`a553c00`) and the new one (`db2e305`) alike. Seen 2026-09-24 while bumping the four consumers for GOTCHAS 62. The push-mode consumers (idss, matou-website, dev-factory itself) pass 44/44. **Cause:** the T2b scenario (#13) pins `SWARM_POLICY_FILE` to a fake `LANDING=pr` policy, but the push-mode scenario before it does NOT pin the seam, so `claim-next-task.sh` sources the consumer's real `.sandcastle/swarm-policy.sh` and prints the PR-branch landing line instead of the push one. Proof: `SWARM_POLICY_FILE=<empty file> bash .sandcastle/tests/claim-next-task-test.sh` → `pass=44 fail=0` in coa. **Rule to land:** every vendored test that exercises a policy-dependent seam must pin `SWARM_POLICY_FILE` (or the equivalent seam) in EVERY scenario, never inherit the host repo's declaration — a vendored test is run from six repos with three different policies. Worth a sweep of the other tests for the same shape (`grep -L SWARM_POLICY_FILE` over tests that source policy-lib), and a GOTCHAS entry. Found during the GOTCHAS 62 consumer bumps (coa #147, matou-app #608, pregnancy-navigator #47, matou-website #13); those PRs ran the test with the seam pinned.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: bug + ready-for-agent.

Why this is a two-way door: the fix lands only in vendored test files
(claim-next-task-test.sh and any sibling with the same shape) plus a
docs/GOTCHAS.md entry — no prompt skeleton, no .sandcastle/ self-copy, no
.forgejo/, so it is not ready-for-session work. It is revertible by a later
commit and it touches nothing on the one-way-door list.

What proves it: the existing tests/claim-next-task-test.sh. Reproduced
during triage — running it with a LANDING=pr policy in scope yields
pass=43 fail=1 (FAIL: push-mode landing line printed on stderr); the same
test is pass=44 fail=0 in this push-mode repo. So a red→green flip in a
pr-mode context, with the push repos staying green, is the whole acceptance
signal.


Agent Brief

Category: bug
Summary: The push-mode landing-line scenario in the vendored
claim-next-task-test.sh does not pin the policy seam, so claim-next-task.sh
sources the host repo's real swarm-policy.sh; in every LANDING=pr consumer
the scenario reds (pass=43 fail=1).

Current behavior:
claim-next-task.sh resolves its landing policy from SWARM_POLICY_FILE, and
when that seam is unset it falls back to the checkout's real
.sandcastle/swarm-policy.sh. The test's default/push-mode landing-line
scenario invokes the script with the seam left unset, asserting the line
landing: push to main. That holds only in push-mode repos. In a LANDING=pr
consumer the fallback policy makes the script print the PR-branch line instead,
so the assertion fails. A later scenario in the same file already pins
SWARM_POLICY_FILE to a fake LANDING=pr policy — the push-mode scenario just
before it does not pin an equivalent push policy, so it inherits the host's
declaration.

Desired behavior:
The test is hermetic: it asserts the same result no matter which of the six
consumer repos (three distinct policies) it is vendored into and run from. Every
scenario that exercises a policy-dependent seam pins SWARM_POLICY_FILE (an
empty file, or an explicit LANDING=push file, both resolve to
landing: push to main) so the host repo's real swarm-policy.sh is never
sourced by the test.

Key interfaces:

  • claim-next-task.sh's landing line — driven by the SWARM_POLICY_FILE test
    seam; unset → real repo policy (production behaviour, do not change).
  • tests/claim-next-task-test.sh — the push-mode landing-line scenario must set
    SWARM_POLICY_FILE to a policy it controls before invoking the script, the
    same way the LANDING=pr (T2b) scenario already does.
  • Any other vendored test that sources policy-lib.sh / touches a
    policy-dependent seam — same fix shape where applicable.

Acceptance criteria:

  • bash tests/claim-next-task-test.sh reports pass=44 fail=0 when a
    LANDING=pr policy is in scope (e.g. run it with SWARM_POLICY_FILE
    pointed at a LANDING=pr file, simulating a pr consumer), AND stays
    pass=44 fail=0 with no policy in scope (push repos).
  • The push-mode landing-line scenario pins SWARM_POLICY_FILE to a
    test-controlled push/empty policy and no longer inherits the host repo's
    swarm-policy.sh.
  • Sweep the other vendored tests for the same shape — grep for tests that
    source policy-lib.sh (or otherwise depend on LANDING) and lack a
    per-scenario SWARM_POLICY_FILE pin; pin any that are affected. State in
    the PR which tests were checked and which were changed (report a clean
    sweep explicitly if nothing else needed pinning).
  • A docs/GOTCHAS.md entry (Symptom → Cause → Rule, severity-marked) is
    added in the same commit: a vendored test that leaves a policy seam unset
    inherits the host repo's declaration and reds only in consumers with a
    different policy.
  • The offline test suite still passes end to end:
    for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done

Out of scope:

  • Any change to claim-next-task.sh's production landing behaviour — the
    SWARM_POLICY_FILE-unset fallback to the real policy is correct and stays.
  • Editing any prompt skeleton, .sandcastle/ self-copy, or .forgejo/ — if the
    sweep surfaces a needed fix in one of those, leave it and re-triage as
    ready-for-session; do not touch it here.
  • Bumping consumer pins — the consumers pick this up at their next pin bump; the
    cross-repo bump is a separate operational task.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `bug` + `ready-for-agent`. **Why this is a two-way door:** the fix lands only in vendored *test* files (`claim-next-task-test.sh` and any sibling with the same shape) plus a `docs/GOTCHAS.md` entry — no prompt skeleton, no `.sandcastle/` self-copy, no `.forgejo/`, so it is not `ready-for-session` work. It is revertible by a later commit and it touches nothing on the one-way-door list. **What proves it:** the existing `tests/claim-next-task-test.sh`. Reproduced during triage — running it with a `LANDING=pr` policy in scope yields `pass=43 fail=1` (`FAIL: push-mode landing line printed on stderr`); the same test is `pass=44 fail=0` in this push-mode repo. So a red→green flip in a pr-mode context, with the push repos staying green, is the whole acceptance signal. --- ## Agent Brief **Category:** bug **Summary:** The push-mode landing-line scenario in the vendored `claim-next-task-test.sh` does not pin the policy seam, so `claim-next-task.sh` sources the *host repo's* real `swarm-policy.sh`; in every `LANDING=pr` consumer the scenario reds (`pass=43 fail=1`). **Current behavior:** `claim-next-task.sh` resolves its landing policy from `SWARM_POLICY_FILE`, and when that seam is unset it falls back to the checkout's real `.sandcastle/swarm-policy.sh`. The test's default/push-mode landing-line scenario invokes the script with the seam left unset, asserting the line `landing: push to main`. That holds only in push-mode repos. In a `LANDING=pr` consumer the fallback policy makes the script print the PR-branch line instead, so the assertion fails. A later scenario in the same file already pins `SWARM_POLICY_FILE` to a fake `LANDING=pr` policy — the push-mode scenario just before it does not pin an equivalent push policy, so it inherits the host's declaration. **Desired behavior:** The test is hermetic: it asserts the same result no matter which of the six consumer repos (three distinct policies) it is vendored into and run from. Every scenario that exercises a policy-dependent seam pins `SWARM_POLICY_FILE` (an empty file, or an explicit `LANDING=push` file, both resolve to `landing: push to main`) so the host repo's real `swarm-policy.sh` is never sourced by the test. **Key interfaces:** - `claim-next-task.sh`'s landing line — driven by the `SWARM_POLICY_FILE` test seam; unset → real repo policy (production behaviour, do not change). - `tests/claim-next-task-test.sh` — the push-mode landing-line scenario must set `SWARM_POLICY_FILE` to a policy it controls before invoking the script, the same way the `LANDING=pr` (T2b) scenario already does. - Any other vendored test that sources `policy-lib.sh` / touches a policy-dependent seam — same fix shape where applicable. **Acceptance criteria:** - [ ] `bash tests/claim-next-task-test.sh` reports `pass=44 fail=0` when a `LANDING=pr` policy is in scope (e.g. run it with `SWARM_POLICY_FILE` pointed at a `LANDING=pr` file, simulating a pr consumer), AND stays `pass=44 fail=0` with no policy in scope (push repos). - [ ] The push-mode landing-line scenario pins `SWARM_POLICY_FILE` to a test-controlled push/empty policy and no longer inherits the host repo's `swarm-policy.sh`. - [ ] Sweep the other vendored tests for the same shape — grep for tests that source `policy-lib.sh` (or otherwise depend on `LANDING`) and lack a per-scenario `SWARM_POLICY_FILE` pin; pin any that are affected. State in the PR which tests were checked and which were changed (report a clean sweep explicitly if nothing else needed pinning). - [ ] A `docs/GOTCHAS.md` entry (Symptom → Cause → Rule, severity-marked) is added in the same commit: a vendored test that leaves a policy seam unset inherits the host repo's declaration and reds only in consumers with a different policy. - [ ] The offline test suite still passes end to end: `for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done` **Out of scope:** - Any change to `claim-next-task.sh`'s production landing behaviour — the `SWARM_POLICY_FILE`-unset fallback to the real policy is correct and stays. - Editing any prompt skeleton, `.sandcastle/` self-copy, or `.forgejo/` — if the sweep surfaces a needed fix in one of those, leave it and re-triage as `ready-for-session`; do not touch it here. - Bumping consumer pins — the consumers pick this up at their next pin bump; the cross-repo bump is a separate operational task.

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

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

close-report for #186 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 186,
  "status": "success",
  "commits": [
    "f053822"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "tests/claim-next-task-test.sh",
    "tests/close-report-test.sh",
    "tests/heal-test.sh",
    "tests/list-ready-tasks-test.sh",
    "tests/rehearsal-healer-test.sh",
    "tests/session-runner-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/claim-next-task-test.sh (no policy in scope)",
      "exit_code": 0
    },
    {
      "command": "SWARM_POLICY_FILE=<LANDING=pr> bash tests/claim-next-task-test.sh -> pass=44 fail=0",
      "exit_code": 0
    },
    {
      "command": "simulated pr consumer (host swarm-policy.sh=LANDING=pr): all six tests green",
      "exit_code": 0
    },
    {
      "command": "full offline suite: for t in tests/*.sh onboarding/tests/*.sh; do bash $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "claim-next-task-test pass=44 fail=0 with a LANDING=pr policy in scope AND with none": "Verified: SWARM_POLICY_FILE=<pr file> -> pass=44 fail=0; ambient host swarm-policy.sh=pr -> pass=44 fail=0; no policy -> pass=44 fail=0 (tests/claim-next-task-test.sh #13 scenario, commit f053822)",
    "push-mode landing-line scenario pins SWARM_POLICY_FILE to a test-controlled push/empty policy": "tests/claim-next-task-test.sh: the #13 scenario now writes LANDING=push to $FAKE_DIR/swarm-policy.sh and pins SWARM_POLICY_FILE inline before invoking claim-next-task.sh",
    "Sweep the other vendored tests for the same shape; pin any affected; state which checked/changed": "Swept the 7 policy_load-fed scripts' tests. CHANGED (affected, RED under pr host policy, now green): close-report-test, heal-test, list-ready-tasks-test, rehearsal-healer-test, session-runner-test. CLEAN (already pinned or direct-source with own policy, not host fallback): policy-lib-test, land-pr-test, run-triage-test, landing-lib-test, ticket-landing-test, prompt-render-lib-test, model-lib-test, close-report-lib-test, preflight-lib-test, run-swarm-stages-test, run-swarm-landing-test, check-harness-drift-test, judgement-call-prompts-test. Detail in the commit message.",
    "docs/GOTCHAS.md entry (Symptom -> Cause -> Rule, severity-marked) added in the same commit": "docs/GOTCHAS.md #63 added in commit f053822",
    "offline test suite passes end to end": "Verified: full loop over tests/*.sh + onboarding/tests/*.sh exits clean, no FAIL"
  },
  "summary": "Pinned a test-controlled LANDING=push policy in every affected scenario of six vendored tests so an unset SWARM_POLICY_FILE no longer inherits the consumer's real swarm-policy.sh, plus GOTCHAS 63 and a STATUS head entry.",
  "blockers": []
}
**close-report** for #186 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 186, "status": "success", "commits": [ "f053822" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "tests/claim-next-task-test.sh", "tests/close-report-test.sh", "tests/heal-test.sh", "tests/list-ready-tasks-test.sh", "tests/rehearsal-healer-test.sh", "tests/session-runner-test.sh" ], "tests": [ { "command": "bash tests/claim-next-task-test.sh (no policy in scope)", "exit_code": 0 }, { "command": "SWARM_POLICY_FILE=<LANDING=pr> bash tests/claim-next-task-test.sh -> pass=44 fail=0", "exit_code": 0 }, { "command": "simulated pr consumer (host swarm-policy.sh=LANDING=pr): all six tests green", "exit_code": 0 }, { "command": "full offline suite: for t in tests/*.sh onboarding/tests/*.sh; do bash $t; done", "exit_code": 0 } ], "criteria": { "claim-next-task-test pass=44 fail=0 with a LANDING=pr policy in scope AND with none": "Verified: SWARM_POLICY_FILE=<pr file> -> pass=44 fail=0; ambient host swarm-policy.sh=pr -> pass=44 fail=0; no policy -> pass=44 fail=0 (tests/claim-next-task-test.sh #13 scenario, commit f053822)", "push-mode landing-line scenario pins SWARM_POLICY_FILE to a test-controlled push/empty policy": "tests/claim-next-task-test.sh: the #13 scenario now writes LANDING=push to $FAKE_DIR/swarm-policy.sh and pins SWARM_POLICY_FILE inline before invoking claim-next-task.sh", "Sweep the other vendored tests for the same shape; pin any affected; state which checked/changed": "Swept the 7 policy_load-fed scripts' tests. CHANGED (affected, RED under pr host policy, now green): close-report-test, heal-test, list-ready-tasks-test, rehearsal-healer-test, session-runner-test. CLEAN (already pinned or direct-source with own policy, not host fallback): policy-lib-test, land-pr-test, run-triage-test, landing-lib-test, ticket-landing-test, prompt-render-lib-test, model-lib-test, close-report-lib-test, preflight-lib-test, run-swarm-stages-test, run-swarm-landing-test, check-harness-drift-test, judgement-call-prompts-test. Detail in the commit message.", "docs/GOTCHAS.md entry (Symptom -> Cause -> Rule, severity-marked) added in the same commit": "docs/GOTCHAS.md #63 added in commit f053822", "offline test suite passes end to end": "Verified: full loop over tests/*.sh + onboarding/tests/*.sh exits clean, no FAIL" }, "summary": "Pinned a test-controlled LANDING=push policy in every affected scenario of six vendored tests so an unset SWARM_POLICY_FILE no longer inherits the consumer's real swarm-policy.sh, plus GOTCHAS 63 and a STATUS head entry.", "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#186
No description provided.