ci red on main: SC2155 in run-swarm.sh:454 (static) + run-swarm-notify-guard-test reads the LIVE fleet-queue cache (test) #326

Closed
opened 2026-11-04 19:38:15 +00:00 by matou-build-agent · 7 comments

ci on main has been red since 19:16 UTC 2026-11-04 — both legs, from
two independent product-class faults. Filed by the watchdog healer
(signature 8236c15c5d67, heal run heal-Matou-dev-factory-1793820858-2258633,
evidence bundle /tmp/matou-heal-Matou-dev-factory.C8FhoJ on
matou-dev-server-01). Both faults are in the factory source at the repo root,
so the healer did not touch them.

The streak (runs.json)

created run leg sha result
16:31 26131 test c760748 failure
16:42 26132 test e8e67a4 success
17:04 26136 test bf8fdf8 success
19:16 26153 test 507c654 failure
19:16 26153 static 507c654 success
19:20 26156 test de5ebb8 failure
19:23 26156 static de5ebb8 failure
19:27 26158 test 2e089d4 failure
19:27 26158 static 2e089d4 failure

Fault 1 — static: SC2155 in run-swarm.sh:454 (deterministic)

job-log.txt job 1 (run 26158):

In run-swarm.sh line 454:
export SWARM_HOST_ATTEMPTS_SINK="$(mktemp)"
       ^----------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
⚙️ [runner]: RUN exit status 1

That is the only shellcheck finding in the tree, and it is the whole
static failure. The line arrived with 5bdc991 (#2112, "the #283
stranded-close reconcile reads a sink that OUTLIVES main.mts's
driveMirrorStop teardown"), which reached main in the 9517ff2 merge
(PR #322 forward-port of the backport/idss-2145 chain). static was green on
507c654 (the last pre-merge sha) and red on every sha after it — a clean
bisect.

.shellcheckrc documents exactly one blanket disable (SC2034) and states
"every other warning stays enabled and is fixed (or line-disabled with a
stated reason)". There is no prior SC2155 disable anywhere in the tree, so the
convention here is the split, not a disable:

SWARM_HOST_ATTEMPTS_SINK="$(mktemp)"
export SWARM_HOST_ATTEMPTS_SINK
export EXECUTE_ATTEMPTS_SINK="$SWARM_HOST_ATTEMPTS_SINK"

(EXECUTE_ATTEMPTS_SINK on the next line is a plain variable expansion, not a
command substitution, so it does not trip SC2155.)

Worth checking the rest of the 9517ff2 forward-port for the same shape — it
is the first commit chain to land here without having passed this repo's own
static leg.

Fault 2 — test: tests/run-swarm-notify-guard-test.sh reads LIVE host state (flapping)

job-log.txt job 0 (run 26158) — the only failing test of the suite:

##[group]tests/run-swarm-notify-guard-test.sh
FAIL: the notify shim must actually have run (else this proves nothing): PREFLIGHT OK: (stub)
...
run-swarm: 2 ready task(s):
  #1410 first
  #1409 second
run-swarm: the fleet head is Matou/dev-factory#309, not a ticket of this repo — standing down; the fleet queue dispatches it (#301)
FAIL: tests/run-swarm-notify-guard-test.sh

Root cause. tests/test-env.sh's test_env_hermetic redirects
SWARM_RUNLOG, SWARM_DB, SWARM_VERDICT_PATH, the Claude limit markers,
HEAL_OFF_FILE and SESSION_RUNNER_TMP — but not
HOST_CAPACITY_STATE_DIR. So fleet_queue_cache_path()
(fleet-queue-lib.sh:201) falls through to its production default
$HOME/swarm/state/fleet-queue.json and the test reads the live fleet
queue of the host it runs on. On the runner right now:

-rw-rw-r-- 1 dev dev 11422 Nov  4 19:30 /home/dev/swarm/state/fleet-queue.json
head: Matou/dev-factory #309   age: 349s  (FLEET_QUEUE_CACHE_TTL=600)

The cache is fresh and its head is in another repo than the test's
REPO_SLUG=Acme/widget, so schedule_fleet_pick (schedule-lib.sh:253)
returns the fleet-head-elsewhere stand-down before run-swarm reaches the
notify seam. The run exits 0 having never called the notify shim, and
assertion 1 ("the notify shim must actually have run") fails. The guard the
test exists to pin (#1424 / GOTCHAS 56) is not broken — the test never gets
to it.

Proven on the host, in a fresh clone of main at 2e089d4:

$ bash tests/run-swarm-notify-guard-test.sh                        # exit 1
$ HOST_CAPACITY_STATE_DIR=$tmp/state bash tests/...notify-guard...  # 2 scenarios passed
$ FLEET_QUEUE_CACHE=$tmp/none.json   bash tests/...notify-guard...  # 2 scenarios passed

This is why the test leg flaps rather than failing cleanly (green at
16:42 and 17:04, red at 16:31 and from 19:16 on): the verdict depends on what
the fleet-queue watcher last wrote and whether it is inside the 600s TTL.

Suggested fix — the same class test-env.sh (#58/#116) exists to close, so
close it at the helper, not just in the one test: export
HOST_CAPACITY_STATE_DIR under the test sandbox in test_env_hermetic, and add
it to the helper's own check-1 loop. Note test_env_hermetic currently leaves
the host's slot locks ($HOST_CAPACITY_STATE_DIR/matou-swarm.lock,
matou-host-slot-2.lock), matou-drive-wanted, drive-log.jsonl,
fleet-recent-closes and fleet-queue-dispatched on their live paths too — the
same leak, currently silent.

Six other tests exec a host-state orchestrator by path and are exposed to the
identical read (none red today only because they stand down earlier or never
reach the fleet pick): claude-call-guards-test.sh, heal-test.sh,
run-swarm-drive-yield-test.sh, run-swarm-limit-park-gate-test.sh,
run-triage-test.sh, session-runner-test.sh.

A per-test override (FLEET_QUEUE_CACHE pinned in
run-swarm-notify-guard-test.sh) fixes today's red but leaves the class open —
please weigh that against the helper change, which may need the existing
per-test HOST_CAPACITY_* overrides re-checked.


Note on reach

Both files are at the repo root, so this fix does not reach the running
vendored self-copy until a human re-vendors
(bash onboarding/onboard.sh vendor .sandcastle <sha>, GOTCHAS 4). ci
itself scans only the root paths, so main goes green as soon as the root fix
lands — but .sandcastle/run-swarm.sh keeps the SC2155 line (harmless; the
static leg does not scan .sandcastle/) until the next pin bump.

`ci` on `main` has been red since 19:16 UTC 2026-11-04 — **both legs**, from **two independent product-class faults**. Filed by the watchdog healer (signature `8236c15c5d67`, heal run `heal-Matou-dev-factory-1793820858-2258633`, evidence bundle `/tmp/matou-heal-Matou-dev-factory.C8FhoJ` on matou-dev-server-01). Both faults are in the factory source at the repo root, so the healer did not touch them. ## The streak (`runs.json`) | created | run | leg | sha | result | |---|---|---|---|---| | 16:31 | 26131 | test | `c760748` | failure | | 16:42 | 26132 | test | `e8e67a4` | success | | 17:04 | 26136 | test | `bf8fdf8` | success | | 19:16 | 26153 | test | `507c654` | **failure** | | 19:16 | 26153 | static | `507c654` | success | | 19:20 | 26156 | test | `de5ebb8` | **failure** | | 19:23 | 26156 | static | `de5ebb8` | **failure** | | 19:27 | 26158 | test | `2e089d4` | **failure** | | 19:27 | 26158 | static | `2e089d4` | **failure** | --- ## Fault 1 — `static`: SC2155 in `run-swarm.sh:454` (deterministic) `job-log.txt` job 1 (run 26158): ``` In run-swarm.sh line 454: export SWARM_HOST_ATTEMPTS_SINK="$(mktemp)" ^----------------------^ SC2155 (warning): Declare and assign separately to avoid masking return values. ⚙️ [runner]: RUN exit status 1 ``` That is the **only** shellcheck finding in the tree, and it is the whole `static` failure. The line arrived with `5bdc991` (#2112, "the #283 stranded-close reconcile reads a sink that OUTLIVES main.mts's driveMirrorStop teardown"), which reached `main` in the `9517ff2` merge (PR #322 forward-port of the backport/idss-2145 chain). `static` was green on `507c654` (the last pre-merge sha) and red on every sha after it — a clean bisect. `.shellcheckrc` documents exactly one blanket disable (SC2034) and states "every other warning stays enabled and is **fixed** (or line-disabled with a stated reason)". There is no prior SC2155 disable anywhere in the tree, so the convention here is the split, not a disable: ```sh SWARM_HOST_ATTEMPTS_SINK="$(mktemp)" export SWARM_HOST_ATTEMPTS_SINK export EXECUTE_ATTEMPTS_SINK="$SWARM_HOST_ATTEMPTS_SINK" ``` (`EXECUTE_ATTEMPTS_SINK` on the next line is a plain variable expansion, not a command substitution, so it does not trip SC2155.) Worth checking the rest of the `9517ff2` forward-port for the same shape — it is the first commit chain to land here without having passed this repo's own `static` leg. ## Fault 2 — `test`: `tests/run-swarm-notify-guard-test.sh` reads LIVE host state (flapping) `job-log.txt` job 0 (run 26158) — the only failing test of the suite: ``` ##[group]tests/run-swarm-notify-guard-test.sh FAIL: the notify shim must actually have run (else this proves nothing): PREFLIGHT OK: (stub) ... run-swarm: 2 ready task(s): #1410 first #1409 second run-swarm: the fleet head is Matou/dev-factory#309, not a ticket of this repo — standing down; the fleet queue dispatches it (#301) FAIL: tests/run-swarm-notify-guard-test.sh ``` **Root cause.** `tests/test-env.sh`'s `test_env_hermetic` redirects `SWARM_RUNLOG`, `SWARM_DB`, `SWARM_VERDICT_PATH`, the Claude limit markers, `HEAL_OFF_FILE` and `SESSION_RUNNER_TMP` — but **not** `HOST_CAPACITY_STATE_DIR`. So `fleet_queue_cache_path()` (`fleet-queue-lib.sh:201`) falls through to its production default `$HOME/swarm/state/fleet-queue.json` and the test reads the **live** fleet queue of the host it runs on. On the runner right now: ``` -rw-rw-r-- 1 dev dev 11422 Nov 4 19:30 /home/dev/swarm/state/fleet-queue.json head: Matou/dev-factory #309 age: 349s (FLEET_QUEUE_CACHE_TTL=600) ``` The cache is fresh and its head is in another repo than the test's `REPO_SLUG=Acme/widget`, so `schedule_fleet_pick` (`schedule-lib.sh:253`) returns the `fleet-head-elsewhere` stand-down **before** run-swarm reaches the notify seam. The run exits 0 having never called the notify shim, and assertion 1 ("the notify shim must actually have run") fails. The guard the test exists to pin (#1424 / GOTCHAS 56) is **not** broken — the test never gets to it. **Proven on the host, in a fresh clone of `main` at `2e089d4`:** ``` $ bash tests/run-swarm-notify-guard-test.sh # exit 1 $ HOST_CAPACITY_STATE_DIR=$tmp/state bash tests/...notify-guard... # 2 scenarios passed $ FLEET_QUEUE_CACHE=$tmp/none.json bash tests/...notify-guard... # 2 scenarios passed ``` This is why the `test` leg **flaps** rather than failing cleanly (green at 16:42 and 17:04, red at 16:31 and from 19:16 on): the verdict depends on what the fleet-queue watcher last wrote and whether it is inside the 600s TTL. **Suggested fix** — the same class `test-env.sh` (#58/#116) exists to close, so close it at the helper, not just in the one test: export `HOST_CAPACITY_STATE_DIR` under the test sandbox in `test_env_hermetic`, and add it to the helper's own check-1 loop. Note `test_env_hermetic` currently leaves the host's **slot locks** (`$HOST_CAPACITY_STATE_DIR/matou-swarm.lock`, `matou-host-slot-2.lock`), `matou-drive-wanted`, `drive-log.jsonl`, `fleet-recent-closes` and `fleet-queue-dispatched` on their live paths too — the same leak, currently silent. Six other tests exec a host-state orchestrator by path and are exposed to the identical read (none red today only because they stand down earlier or never reach the fleet pick): `claude-call-guards-test.sh`, `heal-test.sh`, `run-swarm-drive-yield-test.sh`, `run-swarm-limit-park-gate-test.sh`, `run-triage-test.sh`, `session-runner-test.sh`. A per-test override (`FLEET_QUEUE_CACHE` pinned in `run-swarm-notify-guard-test.sh`) fixes today's red but leaves the class open — please weigh that against the helper change, which may need the existing per-test `HOST_CAPACITY_*` overrides re-checked. --- ## Note on reach Both files are at the repo **root**, so this fix does not reach the running vendored self-copy until a human re-vendors (`bash onboarding/onboard.sh vendor .sandcastle <sha>`, GOTCHAS 4). `ci` itself scans only the root paths, so `main` goes green as soon as the root fix lands — but `.sandcastle/run-swarm.sh` keeps the SC2155 line (harmless; the static leg does not scan `.sandcastle/`) until the next pin bump.
Author
Member

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

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

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

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

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

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

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

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

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

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

⏩ independent reviewer for #326 — verdict unauthenticated

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

close-report for #326 — status success

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

envelope
{
  "issue": 326,
  "status": "success",
  "commits": [
    "7aba67bac79ecb2b04c51971b371d730ec13647a"
  ],
  "changed_files": [
    "run-swarm.sh",
    "tests/test-env.sh"
  ],
  "tests": [
    {
      "command": "bash tests/test-env.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/run-swarm-notify-guard-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n run-swarm.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Fault 1 (static): SC2155 at run-swarm.sh:454 removed per .shellcheckrc (no blanket SC2155 disable allowed)": "run-swarm.sh: the command substitution moved to a plain assignment (SC2155 fires only on export/local/declare/readonly); both names exported on the next line. No SC2155 finding remains; tree still has no SC2155 disable.",
    "The SC2155 fix does not regress the run-swarm-stages-test `< 200` code-line ratchet": "run-swarm.sh stays at 199 code lines (grep -cvE '^[[:space:]]*(#|$)'); the naive declare-then-export split would have been 200 and red the ratchet. Verified in-sandbox: run-swarm-stages-test passes once its unrelated in-sandbox signal leak is neutralized (that residue filed as #330).",
    "Fault 2 (test): run-swarm-notify-guard-test no longer reads the LIVE fleet-queue cache — closed at the helper": "tests/test-env.sh test_env_hermetic now exports HOST_CAPACITY_STATE_DIR under the test sandbox, so host-capacity-lib.sh / fleet-queue-lib.sh no longer fall through to $HOME/swarm/state; run-swarm-notify-guard-test passes (2 scenarios), exit 0.",
    "The helper's own self-guard enforces the new redirect": "tests/test-env.sh check-1 loop now includes HOST_CAPACITY_STATE_DIR; `bash tests/test-env.sh` passes (3 checks), exit 0.",
    "The fix is a root-level change (does not touch the protected vendored .sandcastle/ copy)": "changed_files are run-swarm.sh and tests/test-env.sh at the repo root only; the running .sandcastle/ copy moves only on a human re-vendor (GOTCHAS 4), as the ticket's 'Note on reach' states."
  },
  "summary": "Fixed both ci-red root faults: split the SC2155 command-substitution in run-swarm.sh (keeping it under the 200-line ratchet) and redirected HOST_CAPACITY_STATE_DIR in test-env.sh so run-swarm-notify-guard-test stops reading the host's live fleet-queue cache.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #326 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261105-073544-9e3e7b` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 326, "status": "success", "commits": [ "7aba67bac79ecb2b04c51971b371d730ec13647a" ], "changed_files": [ "run-swarm.sh", "tests/test-env.sh" ], "tests": [ { "command": "bash tests/test-env.sh", "exit_code": 0 }, { "command": "bash tests/run-swarm-notify-guard-test.sh", "exit_code": 0 }, { "command": "bash -n run-swarm.sh", "exit_code": 0 } ], "criteria": { "Fault 1 (static): SC2155 at run-swarm.sh:454 removed per .shellcheckrc (no blanket SC2155 disable allowed)": "run-swarm.sh: the command substitution moved to a plain assignment (SC2155 fires only on export/local/declare/readonly); both names exported on the next line. No SC2155 finding remains; tree still has no SC2155 disable.", "The SC2155 fix does not regress the run-swarm-stages-test `< 200` code-line ratchet": "run-swarm.sh stays at 199 code lines (grep -cvE '^[[:space:]]*(#|$)'); the naive declare-then-export split would have been 200 and red the ratchet. Verified in-sandbox: run-swarm-stages-test passes once its unrelated in-sandbox signal leak is neutralized (that residue filed as #330).", "Fault 2 (test): run-swarm-notify-guard-test no longer reads the LIVE fleet-queue cache — closed at the helper": "tests/test-env.sh test_env_hermetic now exports HOST_CAPACITY_STATE_DIR under the test sandbox, so host-capacity-lib.sh / fleet-queue-lib.sh no longer fall through to $HOME/swarm/state; run-swarm-notify-guard-test passes (2 scenarios), exit 0.", "The helper's own self-guard enforces the new redirect": "tests/test-env.sh check-1 loop now includes HOST_CAPACITY_STATE_DIR; `bash tests/test-env.sh` passes (3 checks), exit 0.", "The fix is a root-level change (does not touch the protected vendored .sandcastle/ copy)": "changed_files are run-swarm.sh and tests/test-env.sh at the repo root only; the running .sandcastle/ copy moves only on a human re-vendor (GOTCHAS 4), as the ticket's 'Note on reach' states." }, "summary": "Fixed both ci-red root faults: split the SC2155 command-substitution in run-swarm.sh (keeping it under the 200-line ratchet) and redirected HOST_CAPACITY_STATE_DIR in test-env.sh so run-swarm-notify-guard-test stops reading the host's live fleet-queue cache.", "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#326
No description provided.