rehearsal reporter: the evidence line redacts the real port/timeout and garbles ANSI into [Nm noise #610

Closed
opened 2026-08-20 02:51:40 +00:00 by matou-build-agent · 2 comments

The rehearsal reporter's evidence line is unreadable — discovered while diagnosing #609.

.sandcastle/rehearsal-report.sh builds the human-facing evidence line with:

evidence_note="drive \`$stamp\` red at \`$leg\`: \`$(normalize_error_line "$err")\`
...

normalize_error_line (.sandcastle/heal-lib.sh) is built for ONE job: folding run-specific noise (ports, timestamps, hex hashes) so the same recurring fault hashes to the same compute_signature. Applying it to the human/agent-facing evidence text as well:

  • redacts every digit to N — the real port number and timeout, exactly what a human/agent needs to diagnose, are gone (port="443" → port="N", Timeout: 600000ms → Timeout: Nms).
  • garbles Playwright's ANSI color codes into literal [Nm noise (the ESC byte's digit gets folded to N by the same rule, and the invisible ESC byte itself renders away, leaving [Nm as visible junk).

The script's own header comment already states the intended design: "The error still drives the diagnosis body" — i.e. the RAW error, not the normalized fold; only the signature should use normalize_error_line.

Fix: add a display_error_line helper beside normalize_error_line — strip ANSI escapes (sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'), collapse whitespace to one line, but never redact digits/hashes — and use it in rehearsal-report.sh's evidence_note construction instead of normalize_error_line.

Why not fixed directly: rehearsal-report.sh and heal-lib.sh are vendored byte-identical from Matou/dev-factory (ADR 0180) — the fix belongs there, then FACTORY_REF bumps and re-vendors here. While scoping this, Matou/dev-factory's main (currently b7d9002) was found to have drifted from this repo's pinned FACTORY_REF (e9aa0bd5c249578d90e6537026e7837a29855bda) in a way that would REGRESS the #596 screenshot-attach feature in rehearsal-report.sh if re-vendored blind today — and e9aa0bd itself is no longer a reachable commit in Matou/dev-factory (git cat-file -e fails after a full fetch; likely rewritten history). Landing this fix needs a session that first reconciles that drift (confirm whether e9aa0bd's content should be restored to dev-factory main, or the #596 feature re-applied as a fresh commit) rather than blindly forking dev-factory's tree further.

heal-lib.sh itself currently matches dev-factory main byte-for-byte (only rehearsal-report.sh has drifted), so the display_error_line half of this fix has no blocker — only the rehearsal-report.sh wiring does.

The rehearsal reporter's evidence line is unreadable — discovered while diagnosing #609. `.sandcastle/rehearsal-report.sh` builds the human-facing evidence line with: ``` evidence_note="drive \`$stamp\` red at \`$leg\`: \`$(normalize_error_line "$err")\` ... ``` `normalize_error_line` (`.sandcastle/heal-lib.sh`) is built for ONE job: folding run-specific noise (ports, timestamps, hex hashes) so the same recurring fault hashes to the same `compute_signature`. Applying it to the human/agent-facing evidence text as well: - redacts every digit to `N` — the real port number and timeout, exactly what a human/agent needs to diagnose, are gone (`port="443"` → `port="N"`, `Timeout: 600000ms` → `Timeout: Nms`). - garbles Playwright's ANSI color codes into literal `[Nm` noise (the ESC byte's digit gets folded to `N` by the same rule, and the invisible ESC byte itself renders away, leaving `[Nm` as visible junk). The script's own header comment already states the intended design: *"The error still drives the diagnosis body"* — i.e. the RAW error, not the normalized fold; only the signature should use `normalize_error_line`. **Fix:** add a `display_error_line` helper beside `normalize_error_line` — strip ANSI escapes (`sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'`), collapse whitespace to one line, but never redact digits/hashes — and use it in `rehearsal-report.sh`'s `evidence_note` construction instead of `normalize_error_line`. **Why not fixed directly:** `rehearsal-report.sh` and `heal-lib.sh` are vendored byte-identical from `Matou/dev-factory` (ADR 0180) — the fix belongs there, then `FACTORY_REF` bumps and re-vendors here. While scoping this, `Matou/dev-factory`'s `main` (currently `b7d9002`) was found to have drifted from this repo's pinned `FACTORY_REF` (`e9aa0bd5c249578d90e6537026e7837a29855bda`) in a way that would REGRESS the #596 screenshot-attach feature in `rehearsal-report.sh` if re-vendored blind today — and `e9aa0bd` itself is no longer a reachable commit in `Matou/dev-factory` (`git cat-file -e` fails after a full fetch; likely rewritten history). Landing this fix needs a session that first reconciles that drift (confirm whether `e9aa0bd`'s content should be restored to dev-factory `main`, or the #596 feature re-applied as a fresh commit) rather than blindly forking dev-factory's tree further. `heal-lib.sh` itself currently matches dev-factory `main` byte-for-byte (only `rehearsal-report.sh` has drifted), so the `display_error_line` half of this fix has no blocker — only the `rehearsal-report.sh` wiring does.
Author
Member

This was generated by AI during triage.

Triage: bug + ready-for-session.

Verified the claim. .sandcastle/heal-lib.sh:25-29 confirms normalize_error_line folds every digit to N, every 7-40 char hex run to H, and collapses whitespace — it's built for compute_signature stability, not human display. .sandcastle/rehearsal-report.sh:313 feeds that same output straight into evidence_note, so the port/timeout numbers a diagnosing agent needs are gone, and ANSI escape sequences degrade to visible [Nm junk (the ESC byte vanishes, its leading digit folds to N). No display_error_line helper exists yet in either file — confirmed by grep. No redundant fix, no matching .out-of-scope/ entry, no open duplicate issue.

Why ready-for-session, not ready-for-agent: both files live under .sandcastle/, a protected path (#445 / ADR 0180) — a swarm worker's before/after tree-fingerprint check rolls back and fails any .sandcastle//.forgejo/ change a worker makes, so this can't go to the swarm queue. The fix also needs to land upstream in Matou/dev-factory (the vendoring contract in .sandcastle/README.md / check-harness-drift.sh: vendored files are canonical there, fixed here only via FACTORY_REF bump + re-vendor) and requires first reconciling that FACTORY_REF (e9aa0bd5c…) is no longer a reachable commit upstream — investigating an external repo's history is outside a swarm worker's sandbox. Both conditions match the ready-for-session bar (ADR 0174 rule 5) exactly: protected .sandcastle/ paths and work needing an interactive session's standing, not Ben.

Why not ready-for-human: no one-way door applies — no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no physical hands. The fix (add display_error_line: strip ANSI via sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g', collapse whitespace, don't touch digits/hashes) is revertible by a later commit either upstream or here, and provable by a new unit test asserting evidence_note retains digits/no [Nm junk for a representative Playwright-timeout line, plus check-harness-drift.sh confirming re-vendor sync. Ruled by agent under ADR 0174 — veto anytime: routing to ready-for-session is itself a two-way door (relabel back to ready-for-agent or ready-for-human any time), proven by the protected-path rule already established at #445/ADR 0180 rather than a fresh judgment call.

Residual scoping note carried over from the issue body: the session picking this up should resolve the Matou/dev-factory main (b7d9002) vs pinned FACTORY_REF (e9aa0bd…, unreachable) drift first — confirm whether e9aa0bd's content should be restored upstream or the #596 screenshot-attach feature re-applied as a fresh commit — before bumping FACTORY_REF and re-vendoring the display_error_line fix into this repo.

> *This was generated by AI during triage.* **Triage: `bug` + `ready-for-session`.** **Verified the claim.** `.sandcastle/heal-lib.sh:25-29` confirms `normalize_error_line` folds every digit to `N`, every 7-40 char hex run to `H`, and collapses whitespace — it's built for `compute_signature` stability, not human display. `.sandcastle/rehearsal-report.sh:313` feeds that same output straight into `evidence_note`, so the port/timeout numbers a diagnosing agent needs are gone, and ANSI escape sequences degrade to visible `[Nm` junk (the ESC byte vanishes, its leading digit folds to `N`). No `display_error_line` helper exists yet in either file — confirmed by grep. No redundant fix, no matching `.out-of-scope/` entry, no open duplicate issue. **Why `ready-for-session`, not `ready-for-agent`:** both files live under `.sandcastle/`, a protected path (#445 / ADR 0180) — a swarm worker's before/after tree-fingerprint check rolls back and fails any `.sandcastle/`/`.forgejo/` change a worker makes, so this can't go to the swarm queue. The fix also needs to land upstream in `Matou/dev-factory` (the vendoring contract in `.sandcastle/README.md` / `check-harness-drift.sh`: vendored files are canonical there, fixed here only via `FACTORY_REF` bump + re-vendor) and requires first reconciling that `FACTORY_REF` (`e9aa0bd5c…`) is no longer a reachable commit upstream — investigating an external repo's history is outside a swarm worker's sandbox. Both conditions match the `ready-for-session` bar (ADR 0174 rule 5) exactly: protected `.sandcastle/` paths and work needing an interactive session's standing, not Ben. **Why not `ready-for-human`:** no one-way door applies — no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no physical hands. The fix (add `display_error_line`: strip ANSI via `sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'`, collapse whitespace, don't touch digits/hashes) is revertible by a later commit either upstream or here, and provable by a new unit test asserting `evidence_note` retains digits/no `[Nm` junk for a representative Playwright-timeout line, plus `check-harness-drift.sh` confirming re-vendor sync. Ruled by agent under ADR 0174 — veto anytime: routing to `ready-for-session` is itself a two-way door (relabel back to `ready-for-agent` or `ready-for-human` any time), proven by the protected-path rule already established at #445/ADR 0180 rather than a fresh judgment call. **Residual scoping note carried over from the issue body:** the session picking this up should resolve the `Matou/dev-factory` `main` (`b7d9002`) vs pinned `FACTORY_REF` (`e9aa0bd…`, unreachable) drift first — confirm whether `e9aa0bd`'s content should be restored upstream or the #596 screenshot-attach feature re-applied as a fresh commit — before bumping `FACTORY_REF` and re-vendoring the `display_error_line` fix into this repo.
Author
Member

Ruling — ADR 0174, two-way door, veto anytime

Fixed at the source per this ticket's own scoping, not forked further:

1. Reconciliation check first. Before touching anything, re-verified the
Matou/dev-factory drift this ticket named as the blocker. It had already
resolved itself upstream since filing: dev-factory main now sits exactly
at the pinned FACTORY_REF (e9aa0bd5c249578d90e6537026e7837a29855bda) —
#596's evidence-attach diff is re-landed as its own commit
(dbb5f39), and e9aa0bd is reachable and IS main's tip. Confirmed both
vendored files (heal-lib.sh, rehearsal-report.sh) were byte-identical to
dev-factory@main before writing a line — check-harness-drift.sh agreed
(OK). The "no blocker" half of the ticket's own analysis (heal-lib.sh) and
the "blocked" half (rehearsal-report.sh wiring) were therefore BOTH unblocked
by session start.

2. Landed in Matou/dev-factory (git.matou.nz/Matou/dev-factory@0e536e4,
TDD — red tests first): a display_error_line helper beside
normalize_error_line — strips ANSI escapes, collapses to one line, never
touches digits/hashes — wired into rehearsal-report.sh's evidence_note
construction in place of normalize_error_line. compute_signature's own
fold is untouched (dedup behaviour unchanged — the existing noise-dedup case
still passes). 5 new offline cases (4 in heal-lib-test.sh, 1 driving the
real reporter script end-to-end in rehearsal-report-test.sh); full
dev-factory suite (40 files) green standalone.

3. Re-vendored here: FACTORY_REF bumped e9aa0bd → 0e536e4,
heal-lib.sh/rehearsal-report.sh and their two tests copied byte-identical,
check-harness-drift.sh green, both offline suites green in this checkout —
114d1fd..3c81a92 on Matou/ourcloud main (3c81a92), dev-factory
main at 0e536e4.

Why this is a two-way door: every step is a plain commit (both repos'
mains), reverting either lands the old evidence-fold behaviour back;
provable by the offline test suites in both repos (all green) plus
check-harness-drift.sh's byte-for-byte check (green). No personal
credentials, no security-posture widening, no trust-surface accept, no data
destroyed, no hardware touched.

Closing — landed, proven, both repos in sync.

## Ruling — ADR 0174, two-way door, veto anytime Fixed at the source per this ticket's own scoping, not forked further: **1. Reconciliation check first.** Before touching anything, re-verified the `Matou/dev-factory` drift this ticket named as the blocker. It had already resolved itself upstream since filing: `dev-factory` `main` now sits exactly at the pinned `FACTORY_REF` (`e9aa0bd5c249578d90e6537026e7837a29855bda`) — `#596`'s evidence-attach diff is re-landed as its own commit (`dbb5f39`), and `e9aa0bd` is reachable and IS `main`'s tip. Confirmed both vendored files (`heal-lib.sh`, `rehearsal-report.sh`) were byte-identical to `dev-factory@main` before writing a line — `check-harness-drift.sh` agreed (`OK`). The "no blocker" half of the ticket's own analysis (heal-lib.sh) and the "blocked" half (rehearsal-report.sh wiring) were therefore BOTH unblocked by session start. **2. Landed in `Matou/dev-factory`** (`git.matou.nz/Matou/dev-factory@0e536e4`, TDD — red tests first): a `display_error_line` helper beside `normalize_error_line` — strips ANSI escapes, collapses to one line, never touches digits/hashes — wired into `rehearsal-report.sh`'s `evidence_note` construction in place of `normalize_error_line`. `compute_signature`'s own fold is untouched (dedup behaviour unchanged — the existing noise-dedup case still passes). 5 new offline cases (4 in `heal-lib-test.sh`, 1 driving the real reporter script end-to-end in `rehearsal-report-test.sh`); full `dev-factory` suite (40 files) green standalone. **3. Re-vendored here**: `FACTORY_REF` bumped `e9aa0bd` → `0e536e4`, `heal-lib.sh`/`rehearsal-report.sh` and their two tests copied byte-identical, `check-harness-drift.sh` green, both offline suites green in this checkout — `114d1fd..3c81a92` on `Matou/ourcloud` `main` (`3c81a92`), `dev-factory` `main` at `0e536e4`. Why this is a two-way door: every step is a plain commit (both repos' `main`s), reverting either lands the old evidence-fold behaviour back; provable by the offline test suites in both repos (all green) plus `check-harness-drift.sh`'s byte-for-byte check (green). No personal credentials, no security-posture widening, no trust-surface accept, no data destroyed, no hardware touched. Closing — landed, proven, both repos in sync.
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/idss#610
No description provided.