rehearsal-heal-lib-test.sh scenario 8 not hermetic against ambient CLAUDE_ACCOUNT_FP #277

Closed
opened 2026-10-17 05:21:59 +00:00 by matou-build-agent · 5 comments

Found while landing #208 (its "offline suite green" clause). tests/rehearsal-heal-lib-test.sh fails identically on clean main at a3c9f50, independent of #208 — a pre-existing red outside that slice.

Symptom

tests/rehearsal-heal-lib-test.sh scenario 8 fails in the worker sandbox:

FAIL: trailer stamped with no fingerprint set

Scenario 8 (tests/rehearsal-heal-lib-test.sh:261-273) commits with no CLAUDE_ACCOUNT_FP intended to be set, then asserts scrub_commit_message leaves the message byte-identical to pre-#223 — no Factory-Account: trailer.

Cause

The worker sandbox exports CLAUDE_ACCOUNT_FP (observed CLAUDE_ACCOUNT_FP=d631bd58e1e9). The scenario-8 clone commit therefore picks up the account fingerprint and the Factory-Account: trailer is stamped, so the "no fingerprint set" assertion trips. The test is not hermetic against the ambient env — the same defect family the #227 arc closed for the other env-fp-keying suites.

Proposed change

  • In tests/rehearsal-heal-lib-test.sh, make the "no fingerprint" scenario hermetic: run it with CLAUDE_ACCOUNT_FP explicitly unset (e.g. ( unset CLAUDE_ACCOUNT_FP; ... )) so the assertion tests the lib, not the ambient sandbox env.
  • Re-run the full offline loop; the suite is green when CLAUDE_ACCOUNT_FP is set in the environment.

This is a test-only hermeticity fix (root tests/, not a protected path).

_Found while landing #208 (its "offline suite green" clause). `tests/rehearsal-heal-lib-test.sh` fails identically on clean `main` at a3c9f50, independent of #208 — a pre-existing red outside that slice._ ## Symptom `tests/rehearsal-heal-lib-test.sh` scenario 8 fails in the worker sandbox: ``` FAIL: trailer stamped with no fingerprint set ``` Scenario 8 (`tests/rehearsal-heal-lib-test.sh:261-273`) commits with no `CLAUDE_ACCOUNT_FP` *intended* to be set, then asserts `scrub_commit_message` leaves the message byte-identical to pre-#223 — no `Factory-Account:` trailer. ## Cause The worker sandbox **exports `CLAUDE_ACCOUNT_FP`** (observed `CLAUDE_ACCOUNT_FP=d631bd58e1e9`). The scenario-8 clone commit therefore picks up the account fingerprint and the `Factory-Account:` trailer is stamped, so the "no fingerprint set" assertion trips. The test is not hermetic against the ambient env — the same defect family the #227 arc closed for the other env-fp-keying suites. ## Proposed change - In `tests/rehearsal-heal-lib-test.sh`, make the "no fingerprint" scenario hermetic: run it with `CLAUDE_ACCOUNT_FP` explicitly unset (e.g. `( unset CLAUDE_ACCOUNT_FP; ... )`) so the assertion tests the lib, not the ambient sandbox env. - Re-run the full offline loop; the suite is green when `CLAUDE_ACCOUNT_FP` is set in the environment. This is a test-only hermeticity fix (root `tests/`, not a protected path).
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: ready-for-agent + bug. This is a test-only hermeticity fix to a root tests/ file — not a protected path, not a prompt skeleton, not .sandcastle/ or .forgejo/ — so a swarm worker may take it (ready-for-agent, not ready-for-session).

Why it's a two-way door: the change touches only tests/rehearsal-heal-lib-test.sh; it is reverted by a single commit, changes no lib and needs no re-vendor (CI runs the root tests/*.sh), and is proven by the existing offline suite. It is on none of the one-way-door items (no credentials, no security widening, no trust accept, no data destruction, no spend).

Proof: reproduced here on a sandbox that exports CLAUDE_ACCOUNT_FP=d631bd58e1e9. bash tests/rehearsal-heal-lib-test.sh fails with FAIL: trailer stamped with no fingerprint set (scenario 8); the same run under ( unset CLAUDE_ACCOUNT_FP; … ) passes — OK: 34 cases. The cause is exactly as filed: scenario 8 asserts the fingerprint-LESS scrub path, but the ambient CLAUDE_ACCOUNT_FP makes scrub_commit_message stamp a Factory-Account: trailer. This is the same defect family the #227 arc (0665d8d, 6e68492) closed for limit-lib / claude-call-guards / session-runner — rehearsal-heal-lib-test.sh was simply not in that sweep.


Agent Brief

Category: bug
Summary: tests/rehearsal-heal-lib-test.sh is not hermetic against an ambient CLAUDE_ACCOUNT_FP; scenario 8 (the no-fingerprint scrub assertion) fails on any token-bearing host.

Current behavior:
The suite's "no fingerprint set" scenario commits and calls scrub_commit_message, then asserts no Factory-Account: trailer is stamped. On a host whose environment exports CLAUDE_ACCOUNT_FP, the scrub picks up that ambient fingerprint and stamps the trailer, so the assertion trips and the whole suite exits red. On a host with the var unset the suite is green.

Desired behavior:
The offline suite controls its own token/fingerprint world and is byte-identical on every host, matching the #227 pattern. The no-fingerprint scenario must assert the lib's fingerprint-LESS path regardless of the ambient environment.

Key interfaces:

  • No lib changes. scrub_commit_message's behavior is correct and stays unchanged — the fix is confined to the test's environment setup.
  • Neutralise the ambient account fingerprint so the no-fingerprint scenario exercises the bare path. Preference is the #227 approach: unset CLAUDE_ACCOUNT_FP (alongside the other CLAUDE_* credential vars that sweep used) once near the top of the suite, so the whole file is hermetic. A scoped ( unset CLAUDE_ACCOUNT_FP; … ) around just that scenario is an acceptable alternative.
  • The fp-keyed scenario (8b) sets CLAUDE_ACCOUNT_FP=abc123def456 per invocation, so it is unaffected by neutralising the ambient default — keep that behavior intact.

Acceptance criteria:

  • bash tests/rehearsal-heal-lib-test.sh passes with CLAUDE_ACCOUNT_FP exported in the environment (reproduce with CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh).
  • It still passes with CLAUDE_ACCOUNT_FP unset.
  • Scenario 8b still asserts exactly one Factory-Account: abc123def456 trailer and remains idempotent on re-scrub.
  • No non-test file changes; rehearsal-heal-lib.sh is byte-identical.
  • The full offline loop stays green: 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 scrub_commit_message or any other lib.
  • Re-vendoring .sandcastle/ (no runtime file changes; consumers inherit the hermetic test at their next pin bump).
  • The other scenarios' behavior; this is only the ambient-fingerprint hermeticity gap.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `ready-for-agent` + `bug`. This is a test-only hermeticity fix to a root `tests/` file — not a protected path, not a prompt skeleton, not `.sandcastle/` or `.forgejo/` — so a swarm worker may take it (`ready-for-agent`, not `ready-for-session`). **Why it's a two-way door:** the change touches only `tests/rehearsal-heal-lib-test.sh`; it is reverted by a single commit, changes no lib and needs no re-vendor (CI runs the root `tests/*.sh`), and is proven by the existing offline suite. It is on none of the one-way-door items (no credentials, no security widening, no trust accept, no data destruction, no spend). **Proof:** reproduced here on a sandbox that exports `CLAUDE_ACCOUNT_FP=d631bd58e1e9`. `bash tests/rehearsal-heal-lib-test.sh` fails with `FAIL: trailer stamped with no fingerprint set` (scenario 8); the same run under `( unset CLAUDE_ACCOUNT_FP; … )` passes — `OK: 34 cases`. The cause is exactly as filed: scenario 8 asserts the fingerprint-LESS scrub path, but the ambient `CLAUDE_ACCOUNT_FP` makes `scrub_commit_message` stamp a `Factory-Account:` trailer. This is the same defect family the #227 arc (0665d8d, 6e68492) closed for `limit-lib` / `claude-call-guards` / `session-runner` — `rehearsal-heal-lib-test.sh` was simply not in that sweep. --- ## Agent Brief **Category:** bug **Summary:** `tests/rehearsal-heal-lib-test.sh` is not hermetic against an ambient `CLAUDE_ACCOUNT_FP`; scenario 8 (the no-fingerprint scrub assertion) fails on any token-bearing host. **Current behavior:** The suite's "no fingerprint set" scenario commits and calls `scrub_commit_message`, then asserts no `Factory-Account:` trailer is stamped. On a host whose environment exports `CLAUDE_ACCOUNT_FP`, the scrub picks up that ambient fingerprint and stamps the trailer, so the assertion trips and the whole suite exits red. On a host with the var unset the suite is green. **Desired behavior:** The offline suite controls its own token/fingerprint world and is byte-identical on every host, matching the #227 pattern. The no-fingerprint scenario must assert the lib's fingerprint-LESS path regardless of the ambient environment. **Key interfaces:** - No lib changes. `scrub_commit_message`'s behavior is correct and stays unchanged — the fix is confined to the test's environment setup. - Neutralise the ambient account fingerprint so the no-fingerprint scenario exercises the bare path. Preference is the #227 approach: `unset CLAUDE_ACCOUNT_FP` (alongside the other `CLAUDE_*` credential vars that sweep used) once near the top of the suite, so the whole file is hermetic. A scoped `( unset CLAUDE_ACCOUNT_FP; … )` around just that scenario is an acceptable alternative. - The fp-keyed scenario (8b) sets `CLAUDE_ACCOUNT_FP=abc123def456` per invocation, so it is unaffected by neutralising the ambient default — keep that behavior intact. **Acceptance criteria:** - [ ] `bash tests/rehearsal-heal-lib-test.sh` passes with `CLAUDE_ACCOUNT_FP` exported in the environment (reproduce with `CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh`). - [ ] It still passes with `CLAUDE_ACCOUNT_FP` unset. - [ ] Scenario 8b still asserts exactly one `Factory-Account: abc123def456` trailer and remains idempotent on re-scrub. - [ ] No non-test file changes; `rehearsal-heal-lib.sh` is byte-identical. - [ ] The full offline loop stays green: `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 `scrub_commit_message` or any other lib. - Re-vendoring `.sandcastle/` (no runtime file changes; consumers inherit the hermetic test at their next pin bump). - The other scenarios' behavior; this is only the ambient-fingerprint hermeticity gap.
Author
Member

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

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

⚠️ Swarm is starving. This repo's swarm has yielded 3 consecutive ticks (most recent reason: slots-busy) with 2 ready-for-agent ticket(s) still open — the host's shared heavy slots have been busy (two long drains hold both slots on every host), so no worker has claimed for them. New tickets here are waiting behind other repos' work; this repo has now declared a want-file so a peer's queue-draining run frees its slot after the current ticket. A human may want to check host capacity.

Ruled by agent under ADR 0174 — veto anytime. Automated starvation signal (Matou/dev-factory #213): posted once per episode, cleared on the next real claim.

⚠️ **Swarm is starving.** This repo's swarm has yielded **3 consecutive ticks** (most recent reason: `slots-busy`) with **2** ready-for-agent ticket(s) still open — the host's shared heavy slots have been busy (two long drains hold both slots on every host), so no worker has claimed for them. New tickets here are waiting behind other repos' work; this repo has now declared a want-file so a peer's queue-draining run frees its slot after the current ticket. A human may want to check host capacity. Ruled by agent under ADR 0174 — veto anytime. Automated starvation signal (Matou/dev-factory #213): posted once per episode, cleared on the next real claim.
Author
Member

⏩ independent reviewer for #277 — verdict unauthenticated

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

close-report for #277 — status success

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

envelope
{
  "issue": 277,
  "status": "success",
  "commits": [
    "3d0a56aa609d28b7867181f900a5094ce75b4edb"
  ],
  "changed_files": [
    "tests/rehearsal-heal-lib-test.sh"
  ],
  "tests": [
    {
      "command": "CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "( unset CLAUDE_ACCOUNT_FP; bash tests/rehearsal-heal-lib-test.sh )",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "passes with CLAUDE_ACCOUNT_FP exported": "CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh -> OK: 34 cases",
    "passes with CLAUDE_ACCOUNT_FP unset": "( unset CLAUDE_ACCOUNT_FP; bash tests/rehearsal-heal-lib-test.sh ) -> OK: 34 cases",
    "scenario 8b still asserts one Factory-Account: abc123def456 and stays idempotent": "scenario 8b sets CLAUDE_ACCOUNT_FP=abc123def456 per invocation, unchanged; suite green",
    "no non-test file changes; rehearsal-heal-lib.sh byte-identical": "commit 3d0a56a changed only tests/rehearsal-heal-lib-test.sh",
    "full offline loop stays green": "loop over tests/*.sh + onboarding/tests/*.sh printed no FAIL lines"
  },
  "summary": "Unset ambient CLAUDE_* credential/fp vars at the top of rehearsal-heal-lib-test.sh so scenario 8 exercises the fingerprint-less scrub path on every host.",
  "blockers": []
}
**close-report** for #277 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 277, "status": "success", "commits": [ "3d0a56aa609d28b7867181f900a5094ce75b4edb" ], "changed_files": [ "tests/rehearsal-heal-lib-test.sh" ], "tests": [ { "command": "CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh", "exit_code": 0 }, { "command": "( unset CLAUDE_ACCOUNT_FP; bash tests/rehearsal-heal-lib-test.sh )", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done", "exit_code": 0 } ], "criteria": { "passes with CLAUDE_ACCOUNT_FP exported": "CLAUDE_ACCOUNT_FP=d631bd58e1e9 bash tests/rehearsal-heal-lib-test.sh -> OK: 34 cases", "passes with CLAUDE_ACCOUNT_FP unset": "( unset CLAUDE_ACCOUNT_FP; bash tests/rehearsal-heal-lib-test.sh ) -> OK: 34 cases", "scenario 8b still asserts one Factory-Account: abc123def456 and stays idempotent": "scenario 8b sets CLAUDE_ACCOUNT_FP=abc123def456 per invocation, unchanged; suite green", "no non-test file changes; rehearsal-heal-lib.sh byte-identical": "commit 3d0a56a changed only tests/rehearsal-heal-lib-test.sh", "full offline loop stays green": "loop over tests/*.sh + onboarding/tests/*.sh printed no FAIL lines" }, "summary": "Unset ambient CLAUDE_* credential/fp vars at the top of rehearsal-heal-lib-test.sh so scenario 8 exercises the fingerprint-less scrub path on every host.", "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#277
No description provided.