Repository navigation
docs(#647): AC-1 capture — Mechanism #1 confirmed at 2181× over 36m - #661
Merged
Merged
Conversation
…es over 36m Captures the `npx sequant run 658 -q` session that produced PR #660, with SEQUANT_DEBUG_RENDERER=1 instrumentation enabled. This is the AC-1 evidence #647 has been waiting for. Headline finding: - terminal.typescript contains 2,181 `SEQUANT WORKFLOW · #N · Xs elapsed` header lines persisted in scrollback (~1 per second over a 36-minute run). Every renderer redraw fails to erase the previous frame from scrollback. Mechanism #1 confirmed at scale. Also captured: - Mid-string char drops + U+FFFD overlay (distinct from #655 Symptom A's byte-math pattern). Cause undetermined — see notes.md for the script(1)-wrapper caveat that prevents discriminating "renderer alone" vs "exacerbated by stderr co-writer." Artifacts: - terminal.typescript: 3.1 MB script(1) byte-stream capture (authoritative) - scrollback.txt: 2.4 KB manual pbpaste from an earlier #656 run - notes.md: run command, counts, symptom summary, caveats Entire-Checkpoint: 45ec46202785
This was referenced May 17, 2026
admarble
added a commit
that referenced
this pull request
May 18, 2026
…ollback (#663) Forensic VT replay of `docs/incidents/647/captures/2026-05-17/terminal.typescript` shows PR #661's "Mechanism #1 confirmed at 2181× over 36m" was reading the wire traffic count (`grep -c`), not actual scrollback occurrences. log-update's eraseLines escapes appear in the typescript file but don't delete prior bytes — those bytes only disappear in a real terminal. When the raw bytes are replayed through a 213×31 VirtualTerminal: - WITHOUT the embedded SEQUANT_DEBUG_RENDERER stderr lines: 1 scrollback header - WITH them (script(1) merged them into the same pty): 2171 scrollback headers - Amplification: 2171× The "Mechanism #1 at scale" was an instrumentation artifact. In a real user terminal without `SEQUANT_DEBUG_RENDERER=1`, log-update's eraseLines works correctly. The underlying bug is Mechanism #2-class: any out-of-band writer (stderr instrumentation, subprocess output landing outside a paused window) breaks log-update's cursor model and strands prior frames in scrollback. Deliverables in this commit: - `docs/incidents/647/captures/2026-05-17/analyze-trace.ts`: reproducible forensic script. Extracts SEQUANT_DEBUG_RENDERER JSON from the typescript, bucket-counts header occurrences by trigger pattern, replays raw bytes through VirtualTerminal both with and without stderr interleaving. - `docs/incidents/647/captures/2026-05-17/analysis.md`: human-readable writeup of the finding with TL;DR, sanity checks (width-mismatch and wrap-mismatch both confirmed at 0/2210), and recommended next steps. - `src/lib/cli-ui/scrollback-harness.ts`: minimal `stderrWrite` injection on `TerminalHarness` so the test renderer's stderr can be routed into the same VT (mirrors how a real pty merges stdout/stderr when both share a tty). - `src/lib/cli-ui/scrollback-harness.test.ts`: lifts the prior `.skip` on the Mechanism #1 reproduction. New test exercises out-of-band writes between log-update redraws and asserts `headerCount === 1` in (visible + scrollback). Marked `it.fails` per the AC-2 contract: test reproduces the bug on main (currently produces 7 occurrences instead of 1), passes once AC-3 lands. Also includes the AC-C Symptom 2 byte-integrity assertion bundled from #662. No production renderer code changed — fix lands in a separate iteration once the diagnosis is socialised. Refs #647, #662.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First production-replay AC-1 capture for #647. Run was
npx sequant run 658 -qwithSEQUANT_DEBUG_RENDERER=1andscript(1)recording the pty. Run completed successfully (PR #660), so this is a "clean" run that nonetheless reproduces Mechanism #1 at scale.Headline:
terminal.typescriptcontains 2,181SEQUANT WORKFLOW · #N · Xs elapsedheader lines persisted in scrollback over a ~36-minute run. That's one new header per second leaked into scrollback — every renderer redraw fails to erase the previous frame. Mechanism #1 (scrollback erasure from event-line scrolling) is confirmed reproducing.What's here
docs/incidents/647/captures/2026-05-17/terminal.typescript— 3.1 MBscript(1)byte-stream (authoritative)docs/incidents/647/captures/2026-05-17/scrollback.txt— 2.4 KB earlier manual save from a#656run (smaller sample of same pattern)docs/incidents/647/captures/2026-05-17/notes.md— run command, counts, symptom summary,script(1)caveatWhat this unblocks for #647
it.skipinscrollback-harness.test.ts) — can be un-skipped using the parameters from this capture.What this does NOT close
complete[0:8] + failed[9:]byte-math overlay) is not in this capture. A different corruption class — mid-string char drops + U+FFFD on header redraws — is present and warrants its own issue.Caveat
script(1)records both stdout and stderr to the typescript file, so the AC-1 instrumentation's stderr output appears mixed with renderer stdout in the capture. The2> debug.jsonlredirect therefore got nothing (debug.jsonlwas 0 bytes, removed from this PR). The instrumentation itself correctly writes to stderr (src/lib/cli-ui/run-renderer.ts:605); the artifact-interleaving is ascriptwrapping property. Discriminating "renderer alone vs. exacerbated by stderr co-writer" for the mid-string-drop symptom requires a follow-up capture withoutscript.Not closing #647
This PR adds evidence; it does not implement the fix. #647 remains open and is ready to move from "investigate" to "fix" with this evidence in hand.