factory drift: #865's sticky-account edit landed in vendored limit-lib.sh but never in Matou/dev-factory — check-harness-drift.sh is RED #867

Closed
opened 2026-08-26 03:16:24 +00:00 by matou-build-agent · 1 comment

Found while working #857 (running the harness suite to check for regressions). Not caused by #857 — reproduced on 2bda2096 with #857's changes stashed.

Symptom

$ bash .sandcastle/check-harness-drift.sh
DRIFT: .sandcastle/limit-lib.sh was edited directly here — it is owned by
       https://git.matou.nz/Matou/dev-factory.git (pinned rev 29c2c946...).
DRIFT: .sandcastle/tests/limit-lib-test.sh was edited directly here — ...
check-harness-drift: FAILED

Cause

Commit 6620f7ca (#865, "the active Claude account goes sticky") changed claude_active_account to drop CLAUDE_ACTIVE_TTL and made the marker sticky, editing limit-lib.sh and tests/limit-lib-test.sh in this repo. Both are in FACTORY_MANIFEST — vendored, owned by Matou/dev-factory (ADR 0180). The change is Ben's 2026-08-26 ruling and is correct; what is missing is landing it upstream, bumping FACTORY_REF and re-vendoring, which #865 never did and never filed.

Why it matters

scripts/seam-smoke.sh runs bash .sandcastle/check-harness-drift.sh as its "Factory core" stage under set -euo pipefail, so on the face of it every ci seam run should now be red. Observed seam runs on 2bda2096 report success, so either the stage is not failing the way the script reads, or something on the runner differs — worth confirming as part of this ticket, because if the gate is silently passing, the door-stays-shut discipline that stage exists for is not shut.

Second cost, regardless: while the drift stands, this repo cannot re-vendor at a newer pin without reverting Ben's sticky-account ruling.

What closing this needs

  1. Land the sticky-account change in Matou/dev-factory (limit-lib.sh + tests/limit-lib-test.sh), carrying #865's reasoning.
  2. Bump .sandcastle/FACTORY_REF here and re-vendor, confirming check-harness-drift.sh goes green.
  3. Confirm whether the ci seam stage was actually failing on this drift, and say which.

Note Matou/dev-factory#101 is also open (a vendored test that reds on any consumer declaring swarm-policy.sh) — the same pin bump should pick it up.

ready-for-session: needs .sandcastle/ (a protected path) plus push standing on Matou/dev-factory.

Found while working #857 (running the harness suite to check for regressions). Not caused by #857 — reproduced on `2bda2096` with #857's changes stashed. ## Symptom ``` $ bash .sandcastle/check-harness-drift.sh DRIFT: .sandcastle/limit-lib.sh was edited directly here — it is owned by https://git.matou.nz/Matou/dev-factory.git (pinned rev 29c2c946...). DRIFT: .sandcastle/tests/limit-lib-test.sh was edited directly here — ... check-harness-drift: FAILED ``` ## Cause Commit `6620f7ca` (#865, "the active Claude account goes sticky") changed `claude_active_account` to drop `CLAUDE_ACTIVE_TTL` and made the marker sticky, editing `limit-lib.sh` and `tests/limit-lib-test.sh` **in this repo**. Both are in `FACTORY_MANIFEST` — vendored, owned by `Matou/dev-factory` (ADR 0180). The change is Ben's 2026-08-26 ruling and is correct; what is missing is landing it upstream, bumping `FACTORY_REF` and re-vendoring, which #865 never did and never filed. ## Why it matters `scripts/seam-smoke.sh` runs `bash .sandcastle/check-harness-drift.sh` as its "Factory core" stage under `set -euo pipefail`, so on the face of it every `ci` seam run should now be red. Observed `seam` runs on `2bda2096` report success, so either the stage is not failing the way the script reads, or something on the runner differs — **worth confirming as part of this ticket**, because if the gate is silently passing, the door-stays-shut discipline that stage exists for is not shut. Second cost, regardless: while the drift stands, this repo cannot re-vendor at a newer pin without reverting Ben's sticky-account ruling. ## What closing this needs 1. Land the sticky-account change in `Matou/dev-factory` (`limit-lib.sh` + `tests/limit-lib-test.sh`), carrying #865's reasoning. 2. Bump `.sandcastle/FACTORY_REF` here and re-vendor, confirming `check-harness-drift.sh` goes green. 3. Confirm whether the `ci` seam stage was actually failing on this drift, and say which. Note `Matou/dev-factory#101` is also open (a vendored test that reds on any consumer declaring `swarm-policy.sh`) — the same pin bump should pick it up. `ready-for-session`: needs `.sandcastle/` (a protected path) plus push standing on `Matou/dev-factory`.
Owner

Step 1 was not "never done" — it was done on the wrong copy

The ticket assumed #865's edit simply never reached Matou/dev-factory. It did reach it, as 22d4a82, whose subject reads exactly right: "the active Claude account goes sticky — B stays primary after a failover until it fails over back (Matou/idss#865)". But its diffstat is:

 .sandcastle/limit-lib.sh            | 21 +++++++++++----------
 .sandcastle/tests/limit-lib-test.sh | 18 ++++++++++++------

Matou/dev-factory is self-hosting — it vendors the factory core into its own .sandcastle/ exactly like a product repo does, pinned at its own FACTORY_REF (dc8d234). So 22d4a82 edited dev-factory's vendored copy of itself, not the canonical root limit-lib.sh that FACTORY_MANIFEST consumers actually pull. Proof:

$ git show 4e74251:limit-lib.sh | grep -c STICKY            # canonical root
0
$ git show 4e74251:limit-lib.sh | grep -c CLAUDE_ACTIVE_TTL
2

So the loop was closed: idss's drift message said "land the fix THERE, bump FACTORY_REF, and re-vendor", the fix had been landed there by subject line, and re-vendoring at ANY dev-factory ref would have silently reverted Ben's ruling. dev-factory runs no check-harness-drift.sh stage in its own ci (unlike idss), so its identical drift was invisible on that side.

One more trap the vendored copy carried: it predates #100's limit-park history, so landing it upstream verbatim would have reverted claude_limit_park's account stamping and its swarm.db park edge. The canonical change had to be re-derived on top of #100, not copied across.

Landed

Matou/dev-factory@e61aa00 puts the ruling on the canonical limit-lib.sh + tests/limit-lib-test.sh, on top of #100. It also moves the two READERS that restate the rule, because a sticky writer with decaying readers is a monitor that lies: tui/data/limits.py's active_account drops its ttl argument (only limit_parked beside it is still a freshness question), and the fleet monitor's fleet-tui/snapshot.py stops decaying _active_letter to the primary. Both would have shown alpha an hour after a failover while every claude call on that host really rode bravo. dev-factory's offline suite is green, tui 169 passed, fleet-tui 50 passed.

Step 3: the ci seam stage was NOT failing on this drift — and the reason is worse than the drift

scripts/seam-smoke.sh ends with:

if seam 2>&1 | tee "$SEAM_LOG"; then ec=0; else ec=${PIPESTATUS[0]}; fi

with the comment "The if keeps set -e fail-fast active inside seam()". It does the opposite. set -e is suspended for any command that is an if condition and for any non-final element of a pipeline — and that suspension propagates into the function body. seam() therefore runs every stage to completion regardless of failures, and returns the status of its LAST command only. Minimal repro:

$ bash -c 'set -euo pipefail; f() { echo A; false; echo B; }
           if f 2>&1 | tee /dev/null; then ec=0; else ec=${PIPESTATUS[0]}; fi; echo "ec=$ec"'
A
B
ec=0

So the answer to "was the gate silently passing": yes, and not just for this stage. Every stage except the last — the drift check, the OpenAPI contract, the mermaid/theming contracts, the TypeScript and Go builds and tests — has been unable to fail ci at all. The whole gate reduces to whether its final command (golangci-lint run ./... in broker/) passes. That is a strictly larger problem than #867 and is being filed separately rather than ridden in on the pin bump.

Ruled by agent under ADR 0174 — veto anytime.

### Step 1 was not "never done" — it was done on the wrong copy The ticket assumed `#865`'s edit simply never reached `Matou/dev-factory`. It did reach it, as `22d4a82`, whose subject reads exactly right: *"the active Claude account goes sticky — B stays primary after a failover until it fails over back (Matou/idss#865)"*. But its diffstat is: ``` .sandcastle/limit-lib.sh | 21 +++++++++++---------- .sandcastle/tests/limit-lib-test.sh | 18 ++++++++++++------ ``` **`Matou/dev-factory` is self-hosting** — it vendors the factory core into its own `.sandcastle/` exactly like a product repo does, pinned at its own `FACTORY_REF` (`dc8d234`). So `22d4a82` edited dev-factory's *vendored copy of itself*, not the canonical root `limit-lib.sh` that `FACTORY_MANIFEST` consumers actually pull. Proof: ``` $ git show 4e74251:limit-lib.sh | grep -c STICKY # canonical root 0 $ git show 4e74251:limit-lib.sh | grep -c CLAUDE_ACTIVE_TTL 2 ``` So the loop was closed: idss's drift message said "land the fix THERE, bump FACTORY_REF, and re-vendor", the fix *had* been landed there by subject line, and re-vendoring at ANY dev-factory ref would have silently reverted Ben's ruling. `dev-factory` runs no `check-harness-drift.sh` stage in its own ci (unlike idss), so its identical drift was invisible on that side. One more trap the vendored copy carried: it predates `#100`'s limit-park history, so landing it upstream verbatim would have reverted `claude_limit_park`'s account stamping and its `swarm.db` park edge. The canonical change had to be re-derived on top of `#100`, not copied across. ### Landed `Matou/dev-factory@e61aa00` puts the ruling on the canonical `limit-lib.sh` + `tests/limit-lib-test.sh`, on top of `#100`. It also moves the two READERS that restate the rule, because a sticky writer with decaying readers is a monitor that lies: `tui/data/limits.py`'s `active_account` drops its `ttl` argument (only `limit_parked` beside it is still a freshness question), and the fleet monitor's `fleet-tui/snapshot.py` stops decaying `_active_letter` to the primary. Both would have shown `alpha` an hour after a failover while every claude call on that host really rode `bravo`. dev-factory's offline suite is green, `tui` 169 passed, `fleet-tui` 50 passed. ### Step 3: the `ci` seam stage was NOT failing on this drift — and the reason is worse than the drift `scripts/seam-smoke.sh` ends with: ```bash if seam 2>&1 | tee "$SEAM_LOG"; then ec=0; else ec=${PIPESTATUS[0]}; fi ``` with the comment *"The `if` keeps `set -e` fail-fast active inside seam()"*. It does the opposite. `set -e` is suspended for any command that is an `if` condition **and** for any non-final element of a pipeline — and that suspension propagates into the function body. `seam()` therefore runs every stage to completion regardless of failures, and returns the status of its LAST command only. Minimal repro: ```bash $ bash -c 'set -euo pipefail; f() { echo A; false; echo B; } if f 2>&1 | tee /dev/null; then ec=0; else ec=${PIPESTATUS[0]}; fi; echo "ec=$ec"' A B ec=0 ``` So the answer to "was the gate silently passing": **yes**, and not just for this stage. Every stage except the last — the drift check, the OpenAPI contract, the mermaid/theming contracts, the TypeScript and Go builds and tests — has been unable to fail `ci` at all. The whole gate reduces to whether its final command (`golangci-lint run ./...` in `broker/`) passes. That is a strictly larger problem than #867 and is being filed separately rather than ridden in on the pin bump. Ruled by agent under ADR 0174 — veto anytime.
ben closed this issue 2026-08-26 18:46:42 +00:00
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/idss#867
No description provided.