session-runner-test.sh reds the suite inside a worker: group 12 asserts a hard-coded slug the fixtures default, so an inherited REPO_SLUG fails it #50

Closed
opened 2026-08-24 02:25:47 +00:00 by matou-build-agent · 2 comments

This was generated by AI during triage.

Symptom

tests/session-runner-test.sh FAILS whenever REPO_SLUG is present in the
environment — which is exactly the environment every swarm worker runs in:

$ env -i PATH="$PATH" HOME="$HOME" bash tests/session-runner-test.sh
session-runner: 15 groups passed

$ env -i PATH="$PATH" HOME="$HOME" REPO_SLUG=Matou/dev-factory bash tests/session-runner-test.sh
FAIL: the seam must name the regenerate command (got: session-runner: identity: swarm-identity.sh is contract 0, this harness needs 1 — re-run: onboard.sh identity Matou/dev-factory .sandcastle/swarm-identity.sh)

Found during headless triage of #48, on a clean tree at 5f8e192.

Cause

Group 12 (the identity-contract seam, #31) writes a fixture "pre-#19 identity
layer" that sets its slug with a default, not an assignment:

: "${REPO_SLUG:=Acme/widget}"

The test then asserts the seam's error names Acme/widget. An inherited
REPO_SLUG wins the :=, the seam correctly reports the inherited slug, and the
assertion — which hard-codes the fixture's value — fails. The fixture is faithful
to a real old identity layer; the test is the part that assumes a clean
environment.

REPO_SLUG is not an exotic variable to have set: run-swarm.sh does
export REPO_SLUG="$repo_slug" and, per its own comment, that is "the value
main.mts forwards into each worker container". The three Forgejo workflows
(swarm.yml, triage.yml, resume-asks.yml) each set it as a step env too.

Impact

Same class as #48: a standing false red in the offline suite, which is the
for t in tests/*.sh … pre-close gate every worker runs (CLAUDE.md rule 2) —
and here the red appears specifically inside a worker, because the worker is
the thing that has REPO_SLUG set. A worker cannot get a green gate, and a real
red hides behind the false one.

A whole-suite scan (tests/*.sh + onboarding/tests/*.sh, each run clean vs.
with REPO_SLUG exported) found this to be the only leak-sensitive test.

Ask

Make group 12 hermetic. Either neutralise the ambient value for the fixture's
run, or assert against the slug the seam actually resolved rather than a
hard-coded literal. The fixture's := defaults should stay as they are — they
are what a real pre-#19 identity layer looked like, and that fidelity is the
point of the case.

Acceptance

  • bash tests/session-runner-test.sh exits 0 with REPO_SLUG exported.
  • bash tests/session-runner-test.sh exits 0 with REPO_SLUG unset.
  • The case still proves what it was minted for (#31): an old identity layer exits
    2 before any API call, names have=0 / need=1, names the regenerate
    command, and posts one rate-limited alarm.
  • git diff touches no file outside tests/.

Out of scope

  • FORGEJO_API (the fixture's other := default) — an inherited value there
    does not affect any assertion; verified green.
  • Any change to session-runner.sh or to the identity seam itself. The
    production behaviour is right; only the test's environment assumption is wrong.

Ruled by agent under ADR 0174 — veto anytime

Ruling: filed as bug + ready-for-agent without waiting for a human. It is
a test-file-only fix with a mechanical, reproducible proof on both sides of the
condition.

Why this is a two-way door: a ticket and a label are revertible by a later
edit; the fix itself touches only tests/, widens no security posture, spends
nothing, destroys nothing.

What proves it: the two commands under Acceptance, run with and without
REPO_SLUG exported.

> *This was generated by AI during triage.* ## Symptom `tests/session-runner-test.sh` FAILS whenever `REPO_SLUG` is present in the environment — which is exactly the environment every swarm worker runs in: ``` $ env -i PATH="$PATH" HOME="$HOME" bash tests/session-runner-test.sh session-runner: 15 groups passed $ env -i PATH="$PATH" HOME="$HOME" REPO_SLUG=Matou/dev-factory bash tests/session-runner-test.sh FAIL: the seam must name the regenerate command (got: session-runner: identity: swarm-identity.sh is contract 0, this harness needs 1 — re-run: onboard.sh identity Matou/dev-factory .sandcastle/swarm-identity.sh) ``` Found during headless triage of #48, on a clean tree at `5f8e192`. ## Cause Group 12 (the identity-contract seam, #31) writes a fixture "pre-#19 identity layer" that sets its slug with a **default**, not an assignment: ```sh : "${REPO_SLUG:=Acme/widget}" ``` The test then asserts the seam's error names `Acme/widget`. An inherited `REPO_SLUG` wins the `:=`, the seam correctly reports the inherited slug, and the assertion — which hard-codes the fixture's value — fails. The fixture is faithful to a real old identity layer; the *test* is the part that assumes a clean environment. `REPO_SLUG` is not an exotic variable to have set: `run-swarm.sh` does `export REPO_SLUG="$repo_slug"` and, per its own comment, that is "the value main.mts forwards into each worker container". The three Forgejo workflows (`swarm.yml`, `triage.yml`, `resume-asks.yml`) each set it as a step env too. ## Impact Same class as #48: a standing false red in the offline suite, which is the `for t in tests/*.sh …` pre-close gate every worker runs (CLAUDE.md rule 2) — and here the red appears *specifically* inside a worker, because the worker is the thing that has `REPO_SLUG` set. A worker cannot get a green gate, and a real red hides behind the false one. A whole-suite scan (`tests/*.sh` + `onboarding/tests/*.sh`, each run clean vs. with `REPO_SLUG` exported) found this to be the **only** leak-sensitive test. ## Ask Make group 12 hermetic. Either neutralise the ambient value for the fixture's run, or assert against the slug the seam actually resolved rather than a hard-coded literal. The fixture's `:=` defaults should stay as they are — they are what a real pre-#19 identity layer looked like, and that fidelity is the point of the case. ## Acceptance - `bash tests/session-runner-test.sh` exits 0 with `REPO_SLUG` exported. - `bash tests/session-runner-test.sh` exits 0 with `REPO_SLUG` unset. - The case still proves what it was minted for (#31): an old identity layer exits 2 **before** any API call, names `have=0 / need=1`, names the regenerate command, and posts one rate-limited alarm. - `git diff` touches no file outside `tests/`. ## Out of scope - `FORGEJO_API` (the fixture's other `:=` default) — an inherited value there does not affect any assertion; verified green. - Any change to `session-runner.sh` or to the identity seam itself. The production behaviour is right; only the test's environment assumption is wrong. --- ## Ruled by agent under ADR 0174 — veto anytime **Ruling:** filed as `bug` + `ready-for-agent` without waiting for a human. It is a test-file-only fix with a mechanical, reproducible proof on both sides of the condition. **Why this is a two-way door:** a ticket and a label are revertible by a later edit; the fix itself touches only `tests/`, widens no security posture, spends nothing, destroys nothing. **What proves it:** the two commands under Acceptance, run with and without `REPO_SLUG` exported.
Author
Member

swarm-claim host=matou-dev-server-01 run=414
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=414 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #50 — status success

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

envelope
{
  "issue": 50,
  "status": "success",
  "commits": [
    "a76e7e01eb4acabbebf70d0f2aa5a4821a93ed62"
  ],
  "changed_files": [
    "tests/session-runner-test.sh"
  ],
  "tests": [
    {
      "command": "env -i PATH=$PATH HOME=$HOME REPO_SLUG=Matou/dev-factory bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "env -i PATH=$PATH HOME=$HOME bash tests/session-runner-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "bash tests/session-runner-test.sh exits 0 with REPO_SLUG exported": "run_runner now env -u REPO_SLUG; verified exit=0 with REPO_SLUG=Matou/dev-factory exported (all 15 groups pass)",
    "bash tests/session-runner-test.sh exits 0 with REPO_SLUG unset": "verified exit=0 with REPO_SLUG unset (all 15 groups pass)",
    "the case still proves what it was minted for (#31): old identity layer exits 2 before any API call, names have=0/need=1, names the regenerate command, posts one rate-limited alarm": "group 12 assertions unchanged and all pass — the fixture's := defaults are untouched and now genuinely applied via env -u REPO_SLUG; seam still exits rc=2, names 'contract 0, this harness needs 1', names 're-run: onboard.sh identity Acme/widget ...', asserts empty curl.log/claude.calls, and 'within cooldown, not reposting'",
    "git diff touches no file outside tests/": "git diff --stat shows only tests/session-runner-test.sh changed (9 insertions, 1 deletion)"
  },
  "summary": "run_runner neutralises an inherited REPO_SLUG so group 12's fixture := default applies, ending the false red that appears inside every worker (which has REPO_SLUG exported).",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #50 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 50, "status": "success", "commits": [ "a76e7e01eb4acabbebf70d0f2aa5a4821a93ed62" ], "changed_files": [ "tests/session-runner-test.sh" ], "tests": [ { "command": "env -i PATH=$PATH HOME=$HOME REPO_SLUG=Matou/dev-factory bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "env -i PATH=$PATH HOME=$HOME bash tests/session-runner-test.sh", "exit_code": 0 } ], "criteria": { "bash tests/session-runner-test.sh exits 0 with REPO_SLUG exported": "run_runner now env -u REPO_SLUG; verified exit=0 with REPO_SLUG=Matou/dev-factory exported (all 15 groups pass)", "bash tests/session-runner-test.sh exits 0 with REPO_SLUG unset": "verified exit=0 with REPO_SLUG unset (all 15 groups pass)", "the case still proves what it was minted for (#31): old identity layer exits 2 before any API call, names have=0/need=1, names the regenerate command, posts one rate-limited alarm": "group 12 assertions unchanged and all pass — the fixture's := defaults are untouched and now genuinely applied via env -u REPO_SLUG; seam still exits rc=2, names 'contract 0, this harness needs 1', names 're-run: onboard.sh identity Acme/widget ...', asserts empty curl.log/claude.calls, and 'within cooldown, not reposting'", "git diff touches no file outside tests/": "git diff --stat shows only tests/session-runner-test.sh changed (9 insertions, 1 deletion)" }, "summary": "run_runner neutralises an inherited REPO_SLUG so group 12's fixture := default applies, ending the false red that appears inside every worker (which has REPO_SLUG exported).", "reason": "", "blockers": [], "no_code_change": "" } ``` </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#50
No description provided.