Repository navigation
Description
Context
Spun out from #652 / closed PR #654. Issue #652 documents two production rendering symptoms:
- Symptom A: event-line characters vanish mid-string (
✔ #505 loop→✔ #5loop— chars05dropped from cols 6/7/8) - Symptom B: U+FFFD + row overlap in summary table
PR #654 shipped a defensive column-binding fix on top of #647 (PR #653). Post-merge of #647, eight parallel agents (four adversarial reviewers + four diagnostic investigators) collectively ruled out every hypothesis the PR was built on. The byte-level pattern remains real but unexplained.
The unexplained pattern
✘ #505 qa QA verdict: AC_MET_BUT_NOT_A_PLUS ← event log
▸ #505 loop ← event log
✔ #5loop Claude Code returned an error result: ... ← corrupted
The corrupted line is mathematically equal to:
complete_line[0:8 bytes] + failed_line[col 9 onward]
Where:
complete_line=✔ #505 loop 60s\n(a "complete" event-line write fromappendEventLine)failed_line=✘ #505 loop Claude Code returned an error result: ETIMEDOUT\n(a "failed" event-line write)- The first 8 bytes (
" ✔ #5"— 6 visible cols) of the complete line are preserved - The text starting at col 9 of the failed line (
"loop Claude Code returned an error result: ETIMEDOUT") appears after
The green ✔ (from the complete event) and the error text (only present on failed events) appearing on the same row are internally inconsistent — they cannot come from a single appendEventLine emission.
Ruled-out hypotheses (do NOT relitigate these)
| # | Hypothesis | Refutation |
|---|---|---|
| 1 | log-update v7 produces mid-string overwrites via internal diff renderer | False. Source dive confirmed line-level diff with full ESC[2K erase per changed line. No partial-overwrite code path. |
| 2 | claude subprocess writes interleave with renderer stdout writes |
Inapplicable in non-verbose mode. Sequant uses @anthropic-ai/claude-agent-sdk in-process; SDK output is captured and never touches process.stdout unless --verbose. The motivating transcript was -q (quiet) mode. |
| 3 | Column-mismatch under npx causes previousLineCount desync → eraseLines over/under-clears → mid-string overwrite |
Empirically refuted. wrapAnsi (used by log-update) inserts actual \n characters into the output string, so the terminal's row count always matches previousLineCount regardless of stream.columns value. Verified with 4 reproduction variants in real PTYs. |
| 4 | SIGWINCH race | Programmatic process.emit("SIGWINCH") during writes did not reproduce the pattern in real PTY testing. |
| 5 | wrap-ansi splitting #505 loop across two lines mid-token |
wrap-ansi inserts \n; terminal sees two separate rows, not a single corrupted row. |
| 6 | renderSummary teardown order race (Symptom B specifically) |
JS is single-threaded; setInterval macrotasks cannot preempt synchronous code. |
What we don't know
- What single-process mechanism produces the
complete[0:8] + failed[9:]overlay pattern?- No cursor positioning escape in log-update can place the cursor at col 6 of an already-written row (only
ESC[G= col 1) - No subprocess shares the TTY fd
- No partial-byte split is possible (UTF-8 boundaries don't apply mid-write at the syscall level)
- No cursor positioning escape in log-update can place the cursor at col 6 of an already-written row (only
Possible next steps
1. Production replay (highest signal)
Run SEQUANT_DEBUG_RENDERER=1 against a scenario known to produce Symptom A. The instrumentation already exists (from #647). Capture:
- Exact byte sequence written to stdout
previousLineCountvalue at each frame- Cursor row/col before/after each write
- Whether
appendEventLinewas called twice for the same(issue, phase)tuple
If repro happens in real terminal but not synthetic harness, the diff is the cause.
2. PTY-based test harness
Build a harness that wraps real process.stdout and a real PTY (via node-pty or script-style FIFO) so the synchronous-VT limitation of scrollback-harness.ts is removed. Then attempt deterministic reproduction.
3. Static analysis of all stdout writers in non-verbose mode
Audit every process.stdout.write, console.log, and similar call reachable during npx sequant run ... -q. Catalog what each writes. The forensic pattern implies a second writer exists; identify it.
4. Different mechanism entirely
The forensic pattern matches the byte math of an interleaved write, but there's no proven mechanism. Possibilities to test:
- Node's
process.stdoutwrite queue under backpressure (unlikely — TTY writes are sync, not buffered) - Terminal-emulator-side rendering bug (test in multiple terminals: iTerm2, Apple Terminal, gnome-terminal, etc.)
- An
unhandledRejectionor error handler writing to stdout out-of-band
Investigation artifacts
- Closed PR fix(#652): renderer bottom-output corruption — column-binding + renderSummary teardown order #654 has 8 detailed agent reports in its commit messages and comment thread
- Branch
feature/652-fix-cli-renderer-bottom-outputpreserved with the (irrelevant-to-Symptom-A) defensive cleanup, kept in case the bound-stream design becomes useful once the actual cause is known - Repro scripts saved to local
/tmp/:symptom-a-repro.mjs,cursor-trace.ts,check-wrap.ts, etc.
Acceptance criteria
- Capture a real
SEQUANT_DEBUG_RENDERER=1trace from a corrupted run - Identify the responsible code path with byte-level evidence
- Produce a regression test that fails on the current main and passes after the fix
- Ship a targeted fix (not defensive cleanup)
Out of scope
- Defensive renderer refactors that aren't motivated by reproduced evidence
- The pause/resume dead-code bug — filed separately (sub
batch-executornever passesspinnertoexecutePhaseWithRetry)
Activity
admarble commentedon May 16, 2026
/spec: Implementation Plan
Complexity: Complex — 4 ACs, diagnose-first investigation.
complexlabel honored.AC Checklist
SEQUANT_DEBUG_RENDERER=1trace from a corrupted run.docs/incidents/655/with a README on how to reproduce.docs/incidents/655/forensic.md) naming file:line, the offending byte sequence, and reconciling with the issue body's ruled-out hypotheses.origin/mainand passes after AC-4.scrollback-harness.test.tsextension, or newpty-harness.test.tsif AC-2 mechanism is timing-dependent.docs/incidents/655/negative-result.mdand leave instrumentation in place rather than shipping a speculative fix.logUpdateClear-adjacent state, audit all sixlogUpdateClearcallsites inrun-renderer.ts(747, 791, 804, 822, 839, 880).Plan (4 phases, hard-sequential)
TTYRendererfirst (deterministic, fast). Escalate to livenpx sequant run -qreplay only if synthetic doesn't trigger the symptom.-qmode (renderer'sstdoutWrite,phase-executor.ts:675— gated onverbose,heartbeat.ts:97, anyconsole.*). Reconcile AC-1 trace with byte mathcomplete[0:8] + failed[9:]. Run an adversarial pass against confirmation bias.Decision branches
Open questions (need user confirmation before /exec)
needs-reprolabel OK to add?Non-goals (from issue body)
Workflow
/exec 655→/qa 655. Quality loop auto-enabled. No testgen / no browser test / no security-review. Existingfeature/655-…worktree is ready.admarble commentedon May 16, 2026
/exec: AC-D1 path (no reproduction; awaiting real-run trace)
Per spec phase 1 (synthetic first), /exec confirmed the #647 scrollback harness does not reproduce Symptom A and added one further lock-in test against the motivating issue's exact complete→failed event sequence. Per spec phase 2 (static analysis), every stdout writer reachable from
npx sequant run … -qwas audited; the renderer owns stdout end-to-end (phase-executor:675 is verbose-gated, heartbeat is NonTTY-only, no global handlers write). The forensic byte math therefore implicates terminal-emulator behavior, a missed writer, or a measurement artifact — discriminating between these requires AC-1 evidence from a real corrupted run, which/execcannot drive autonomously.AC coverage
Files changed
docs/incidents/655/negative-result.md(new) — static-analysis audit, what was tried, capture instructionssrc/lib/cli-ui/scrollback-harness.test.ts— added complete→failed overlay-detector testChecks
npm test -- --run src/lib/cli-ui/— 92 passed, 1 skippednpm run build— cleannpm run lint— cleanPR
#657 — opens against
main. Satisfies AC-D1 only; #655 should remain open until a real-run trace lands.Recommended next step (HITL)
Run against a scenario known to produce Symptom A. Commit both artifacts and re-invoke
/spec 655or/exec 655to advance from AC-1.Quality Plan Alignment
N/A — No quality plan in issue (
/specdid not emit a Feature Quality Planning section; spec is a 4-phase plan with derived ACs).admarble commentedon May 16, 2026
QA Review for Issue #655 (AC-D1 partial scope)
This PR (#657) implements only AC-D1 (negative-result path). AC-1..4 remain deferred per the spec phase's decision branch (
AC-1 doesn't reproduce → AC-D1 path), pending HITL real-run capture. The issue should remain open.AC Coverage
SEQUANT_DEBUG_RENDERER=1trace from a corrupted runrun-renderer.ts:557-606; capture instructions indocs/incidents/655/negative-result.md§"How to capture AC-1"docs/incidents/655/negative-result.mdand leave instrumentation in placelogUpdateClearcallsites if AC-2 implicates themCoverage: 1/1 in-scope AC met (AC-D1). Out-of-scope ACs explicitly deferred per spec decision matrix — not blockers for this PR.
CI Status
build (20.x)build (22.x)typecheckvalidate-pluginvalidate-skillsAll checks green.
Quality Metrics
any)Test Coverage Analysis
The PR adds tests but does not change production code. The new lock-in test:
src/lib/cli-ui/scrollback-harness.test.ts— adds"#655 negative-result lock-in: complete→failed event sequence does not produce an overlay row"npx vitest run src/lib/cli-ui/scrollback-harness.test.ts→ 5 passed, 1 skipped ✅Test asserts the overlay regex never appears in any synthetic harness row (scrollback + visible) when driving the motivating issue's exact complete→failed
loopevent sequence at a 100-col stream × 80-col physical mismatch with a pause/resume cycle between events.Coverage: N/A — no production code added; test locks in the negative-result invariant for future regression detection.
Code Review
Strengths:
loopthen failed-loopfor the same#505) through the existing fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 harness, including the pause/resume cycle that mimics verbose subprocess streaming. The overlay-detector assertion (✔ AND "Claude Code returned"on a single row) is well-anchored to the issue's forensic byte math.run-renderer.ts:131-132,run-renderer.ts:557-606,run-renderer.ts:664-676,phase-executor.ts:675).Issues:
Minor precision gap — "heartbeat is NonTTY-mode only" is inaccurate. The doc's static-analysis table (line 34) and TL;DR (line 10) characterize
LivenessHeartbeatas "NonTTY-mode only," but the actual wiring insrc/commands/run-progress.ts:46-49isquiet && !tuiEnabled— i.e.-qmode (which may be TTY or non-TTY). The substantive claim (heartbeat is not a competing stdout writer when the renderer is the active path) still holds because heartbeat and renderer are mutually exclusive inrun-progress.ts, but the mode characterization should read "quiet-mode only" not "NonTTY-mode only." Worth one-line fix in the doc so the next investigator isn't confused.Open contradiction in the static analysis worth surfacing. The issue body claims "the motivating transcript was
-q(quiet) mode." ButappendEventLine(which produces the✔/✘/▸glyphs in the corrupted transcript) is aTTYRenderermethod, and the renderer is not wired in quiet mode (run-progress.ts:59-60constructs the renderer only when!quiet). Either (a) the original transcript was actually default mode, not-q, or (b) the wiring has changed since feat(cli): unified run renderer — two-zone live grid + events #618 introduced the renderer, or (c) the heartbeat path produces something that looks like renderer output. The negative-result doc doesn't acknowledge this contradiction. The AC-1 capture in-qmode against current wiring would not exerciseappendEventLineat all — so the AC-1 capture instructions in the doc should clarify which mode is intended. Recommendation: add a sentence to the doc noting this discrepancy so the HITL capture is run in the correct mode.Suggestions:
harness.stdoutWrite(" [verbose] streamed line between events\n")simulates verbose subprocess streaming, but in production the verbose write goes throughprocess.stdout.write(chalk.gray(text))atphase-executor.ts:675. The directharness.stdoutWriteexercises the VT but bypasses the chalk wrapping. This is acceptable for a pause/resume cycle exerciser, but worth a one-line comment noting the simplification.Anti-Pattern Detection
N/A — only docs and a test file changed.
CHANGELOG Verification
[Unreleased]section presentdocs(#655):commit triggers the gate[Unreleased]Note: The §10a gate fires because the commit is conventional-commit-prefixed (
docs(...)). However, the content is internal investigation documentation (docs/incidents/...) plus a lock-in test — not user-facing behavior. Existing[Unreleased]entries are feature-level (Typed workflow event system,Phase definitions consolidated). Reviewer call: either skip (incident docs aren't user-visible) or add a one-lineDocumentationsubsection entry like- #655 incident investigation: documented negative-result for synthetic Symptom A reproduction (#657).Risk Assessment
Adversarial Re-Read
Findings:
Motivating-example fixture check: The issue body's literal motivating transcript (
✔ #5loop Claude Code returned an error result: ETIMEDOUT) is the exact pattern the lock-in test's overlay detector asserts against. The test'sharness.vt.scrollback + getVisibleLines()is run through the verbatimcomplete loop→failed loopsequence on issue arch: phase plugin registry — user-extensible workflow phases #505 at the configured width mismatch. The detector regex matches against✔and"Claude Code returned"substrings — both present in the issue's literal example. Fixture wired correctly.Evidence vs. claim audit: The doc presents a negative result honestly. It does not claim AC-1..4 are met — it explicitly defers them with a "Deferred" status and provides capture instructions for the next iteration. No "post-fix validation" claims are made because no fix is shipped. This is the correct posture for the AC-D1 path.
Process state: Branch is clean (
git statusempty), 1 commit ahead oforigin/main, no uncommitted work. Tests pass locally and in CI.Sibling sites: N/A as noted above. No code patterns to scan.
Non-Goals check: Issue body's two Non-Goals are "Defensive renderer refactors that aren't motivated by reproduced evidence" and "the pause/resume dead-code bug — filed separately." Neither is violated — this PR adds zero defensive cleanup and does not touch pause/resume wiring.
Gaps surfaced (non-blocking):
-q-mode vsappendEventLinecontradiction is unresolved and not acknowledged in the doc (Issue docs: Add pre-release checklist #2 above).Status: Gaps Found (non-blocking — both are doc precision fixes, not load-bearing logic errors)
Verdict: AC_MET_BUT_NOT_A_PLUS
AC-D1 is fully met: negative-result doc committed, instrumentation unchanged, no speculative fix, regression-detection lock-in test added and passing. AC-1..4 are explicitly deferred per the spec's decision matrix and are appropriate for follow-up HITL work — they do not block this PR.
The verdict is not READY_FOR_MERGE because of two non-blocking doc precision gaps:
-q-mode claim and the renderer being unwired in quiet mode — material for the next investigator's AC-1 capture.These are 1-2 line fixes to
docs/incidents/655/negative-result.md. Either fix-and-merge, or merge-and-fix-in-followup.Documentation
Next Steps
docs/incidents/655/negative-result.md:run-progress.ts:46-49)"-qmode, so AC-1 capture should be run in default (non-quiet) mode unless the original transcript's mode is reconfirmed.SEQUANT_DEBUG_RENDERER=1 script -q artifact/terminal.typescript npx sequant run ... 2> artifact/debug.jsonlagainst a Symptom A-producing scenario; commit captures underdocs/incidents/655/captures/<date>/and re-invoke/spec 655or/exec 655to advance from AC-1.docs(#655): fix static-analysis table mode wiring + flag AC-1 mode di…
admarble commentedon May 16, 2026
/exec: applied QA doc precision fixes (PR #657 follow-up commit)
QA review returned
AC_MET_BUT_NOT_A_PLUSwith two non-blocking doc precision gaps. Per "fix-and-merge vs. merge-and-fix-in-followup", took the fix-and-merge path and pushedba35122to PR #657. AC-D1 status is unchanged; AC-1..4 remain deferred awaiting HITL real-run capture.What changed
LivenessHeartbeatrow "NonTTY-mode only" → corrected to "quiet-mode only" withrun-progress.ts:46-49referencedocs/incidents/655/negative-result.mdtable-q; original transcript's mode label is suspect) and the example command drops-qdocs/incidents/655/negative-result.mdcapture sectionTTYRenderer.stdoutWriterow in the same table also had the inverse error ("Yes, sole intended writer" for-q— but the renderer isn't wired in-q). Corrected to "No in-q— sole writer in default mode and emits all✔/✘/▸glyphs"docs/incidents/655/negative-result.mdtableAdditional finding worth recording
LivenessHeartbeatwrites▸ #N phase (elapsed, …)heartbeat lines to stdout but never✔/✘/▸ #N phaseevent glyphs. This means the✔in the corrupted transcript can only come fromTTYRenderer. The renderer is mutually exclusive with-qmode in current wiring (run-progress.ts:59-60). One of: (a) original transcript was default mode, not-q; (b) wiring changed since capture; (c) original mode label is wrong. The next HITL capture should re-confirm mode before running.AC coverage (unchanged from prior /exec)
Checks
MERGEABLE, awaiting fresh check results).PR
#657 — head now at
ba35122. Ready for re-merge once new CI completes.Files changed in this iteration
docs/incidents/655/negative-result.md(+9 / -7)Quality Plan Alignment
N/A — no quality plan in spec.
Next steps
ba35122to go green (expected — markdown-only change against the same green baseline).-q) against a Symptom A-producing scenario; committerminal.typescript+debug.jsonlunderdocs/incidents/655/captures/<date>/; re-invoke/spec 655or/exec 655.admarble commentedon May 17, 2026
QA Review for Issue #655 (Simple Fix — doc precision follow-up to prior QA)
Re-QA of commit
ba35122against prior QA verdict atd57dd20(AC_MET_BUT_NOT_A_PLUSwith two doc-precision gaps recommended).Size Gate
AC Coverage (unchanged from prior QA)
Coverage: 1/1 in-scope AC met. No regression.
QA Fix Verification
Prior QA recommended two fixes. Verification of each:
LivenessHeartbeatrow says "NonTTY-mode only" — actual gating isquiet && !tuiEnabled-qmode (seerun-progress.ts:46-49)... never✔/✘"run-progress.ts:46-49readsquiet && !tuiEnabled ? new LivenessHeartbeat(...) : null— match.heartbeat.ts:226only emits▸glyph, never✔/✘— match.-qcontradiction-qrun-progress.ts:59-60reads!tuiEnabled && !quiet ? createRunRenderer(...) : null— confirms renderer is NOT wired in-q. Callout is accurate.-q)-q— sole writer in default mode"Both prior gaps substantively addressed; bonus consistency fix is correct.
Quality Metrics
any)Code Review
Strengths:
▸ #N phase (elapsed, …)heartbeat lines, never✔/✘" — verified atheartbeat.ts:225-226.heartbeat.ts:100, :226,run-progress.ts:46-49,run-progress.ts:59-60).Issues:
Residual sibling-prose: TL;DR (line 10) still says "the renderer is the sole stdout writer in non-verbose mode." The corrected §2 table now establishes that in
-qmode (which IS non-verbose), the heartbeat — not the renderer — is the sole writer. The TL;DR's framing therefore contradicts the corrected analysis directly below it. A future reader skimming the TL;DR could conclude the renderer writes in-qmode, which is exactly the false claim the commit was meant to retire from the doc. Worth a one-line edit:confirms the renderer is the sole stdout writer in non-verbose mode.→confirms there is no second stdout writer in either run mode (renderer in default, heartbeat in -q).This is the
feedback_sibling_scan_includes_prose.md/feedback_grep_as_checklist.mdpattern: after a substantive correction, grep for the old framing to verify it's fully retired across the file. The substantive correction here was thorough in §2 and §"How to capture AC-1", but the TL;DR was missed.Suggestions:
Test Coverage Analysis
docs/incidents/655/negative-result.mdCoverage: N/A — docs-only change.
Anti-Pattern Detection
N/A — no code changed.
CI Status (PR #657 at
ba35122)build (20.x)build (22.x)typecheckvalidate-pluginvalidate-skillsCI Summary: 5 passed, 0 pending, 0 failed.
Risk Assessment
Verdict: AC_MET_BUT_NOT_A_PLUS
Both prior QA gaps were substantively addressed with verified-correct edits; bonus consistency fix is right. The PR is mergeable.
Verdict is not READY_FOR_MERGE because of one residual sibling-prose gap: TL;DR line 10 still says "the renderer is the sole stdout writer in non-verbose mode," which contradicts the corrected §2 table (in
-qmode, heartbeat is the writer). This is the same class of bug the commit was meant to fix, just at a different site in the same file. One-line fix.Reviewer call: either fix-and-merge (one-line edit to line 10) or merge-and-fix-in-followup. Given this is the second iteration of "doc precision" gaps on the same file, fix-and-merge is preferred to avoid a third round.
Documentation
Next Steps
docs/incidents/655/negative-result.md).docs/incidents/655/captures/<date>/; re-invoke/spec 655or/exec 655to advance from AC-1.admarble commentedon May 17, 2026
HITL capture checklist — unblocks both #647 (Mechanism #1 + AC-1 replay) and #655 (AC-1..2)
PR #653 shipped
SEQUANT_DEBUG_RENDERER=1. PR #657 confirmed the synthetic harness cannot reproduce Symptom A. Both issues' remaining ACs are now blocked on the same artifact.Capture command:
Target scenarios (try in order until a symptom fires):
Artifacts to commit:
terminal.typescript— raw byte stream fromscriptdebug.jsonl— instrumentation lognotes.md— terminal app,$COLUMNS × $LINES, Node version, which symptom firedWhat each unblocks:
SEQUANT WORKFLOW · …≥2× in scrollback✔ #5loop/ mid-string char drop / U+FFFD overlaySanity before
/assess:wc -l debug.jsonl≥ ~10jq -s 'group_by(.callsite) | map({callsite: .[0].callsite, count: length})' debug.jsonlterminal.typescriptfor the symptomDo NOT rerun
/fullsolveon either issue until a capture lands — autonomous loops without new evidence will reproduce the negative-result deferral pattern (#657) or relitigate static analysis. The blocker is real-terminal evidence; oncedebug.jsonlis committed,/assessand/fullsolvebecome productive again because byte-level mechanism ID moves into scope.docs(#655): sweep TL;DR + section heading for `-q`-scoped framing
docs(#655): AC-D1 negative result — synthetic harness does not reprod…
admarble commentedon May 17, 2026
Update —
-qflag finding changes the interpretation, not the static analysisLive run of
npx sequant run 656 -qin a separate session showed renderer output (table grid +SEQUANT WORKFLOW · #N · …elapsed). That text is only emitted byrun-renderer.ts:929/955/995, gated behind!quiet.Root cause:
-qis the short form for--quality-loop, not--quiet(bin/cli.ts:234vs:250). Filed as #658.What this changes for #655:
The static analysis in
docs/incidents/655/negative-result.mdis correct in the abstract — default mode → renderer,--quietmode → heartbeat, mutually exclusive. What changes is the interpretation of the motivating transcript: every "in-qmode" reference in #647/#652/#654/#655 was actually renderer mode, because-qdoesn't setquiet=true. The corruption symptoms (✔ #5loop, U+FFFD overlay) were produced by the renderer, not the heartbeat.Practical consequence: #647's Mechanism #1 hypothesis (scrollback erasure from event-line scrolling with renderer active) is the right hypothesis after all. The detour through "heartbeat is the writer" was based on a wrong premise about what
-qdoes.Recommended doc amendment in a follow-up commit:
npx sequant run …(default — no flag) ornpx sequant run … -q(current-qhappens to enable renderer + quality-loop, which is fine for renderer evidence).npx sequant run … --quiet(long form).AC-1 evidence already in hand: the live scrollback from the running
-qsession shows twoSEQUANT WORKFLOW · #656 · …elapsedheaders — Mechanism #1 reproducing. Saving underdocs/incidents/647/captures/2026-05-17/is the first concrete AC-1 artifact for #647.docs(#647): AC-1 capture — Mechanism #1 reproducing at 2181 occurrenc…
admarble commentedon May 18, 2026
Cross-reference — #647's #663 finding may be the unified suspect
PR #663 (merged 2026-05-18) closed the diagnosis loop on #647 with a finding that's directly relevant here:
The underlying bug behind #647 Mechanism #1 is Mechanism #2-class: any out-of-band writer that touches the same pty as
process.stdoutbreaks log-update's cursor model. Forensic VT replay showed log-update'seraseLines(previousLineCount)undershoots after out-of-band writes becausepreviousLineCountonly tracks log-update's own writes — anything that scrolls the terminal externally (stderr instrumentation, subprocess output landing outside a paused window, future feature) leaves the cursor at an unknown offset.Why this is interesting for #655 Symptom A
The
complete[0:8] + failed[9:]byte math has always required something to position the cursor mid-row of the previously-written complete line before the failed line writes. Mechanism #2 supplies a candidate:appendEventLine(complete):logUpdateClear()→ writes complete line via stdoutWrite →redraw()writes live zone. Cursor at end-of-frame.--quiet).appendEventLine(failed):logUpdateClear()issueseraseLines(previousLineCount)going UP from the wrong cursor — lands the cursor mid-row of the prior complete line (col 8 if the geometry works out).complete[0:8] + failed[9:].This is consistent with the byte math, but not yet proven for #655. Mechanism #1 (scrollback duplication) and Symptom A (mid-row overlay) would share a root cause — Mechanism #2 — if confirmed.
Cheapest discriminator: the HITL capture already queued for #647
The clean-baseline capture I asked for in #647 (run
npx sequant run X Yparallel, default mode, WITHOUTSEQUANT_DEBUG_RENDERER=1, save scrollback) is also the cheapest #655 reproducer. If that capture shows:SEQUANT WORKFLOW ·headers: fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 still has residual bug → Mechanism docs: Add pre-release checklist #2 candidate confirmed.complete[0:n] + failed[n+1:]overlay rows: investigate(cli): #652 renderer corruption — column-mismatch hypothesis refuted, real cause unknown #655 Symptom A reproduces in current code → Mechanism docs: Add pre-release checklist #2 candidate confirmed for investigate(cli): #652 renderer corruption — column-mismatch hypothesis refuted, real cause unknown #655 too.Synthetic harness status
The
#655 negative-result lock-intest inscrollback-harness.test.ts(preserved through PR #663) still passes — synthetic doesn't reproduce Symptom A. That's expected: the synthetic harness models a clean pty without subprocess output interleaving. If the HITL capture confirms Mechanism #2 for #655 too, a fuller harness with subprocess-output simulation would be needed for a regression test (extending thestderrWritepattern PR #663 added).Suggested status
Keep #655 open until the HITL capture lands. If the unified-suspect hypothesis is confirmed, the AC-3 fix iteration on #647 should bundle #655 (same fix). If not, #655 needs independent diagnosis using the leftover options from this issue's "Possible next steps" section (PTY-based harness, static analysis of all stdout writers).
admarble commentedon May 20, 2026
Capture task spun out → #668
The 2026-05-17 HITL capture in this issue is no longer diagnostic — both wire-amplifiers it captured have since been removed:
SEQUANT_DEBUG_RENDERERto a file (eliminates the 2,171 spurious header lines from stderr co-writing the pty)console.logsites inphase-executor.ts+ 2 batch-boundary sites inRunOrchestrator.run(eliminates the Mechanism docs: Add pre-release checklist #2-class duplicate-header leak)A fresh capture is needed to isolate Symptom A from the eliminated noise. Tracked separately in #668 so the capture is a discrete unit of work that can be assigned/scheduled independently of this investigation's analysis ACs.
This issue stays open as the investigation parent. Once #668 lands a capture, AC-1..4 here become actionable.
admarble commentedon May 30, 2026
Capture landed (#668) — renderer exonerated with byte-level evidence
A real HITL capture was run from
matcha-maps(sequant run 593 627) on two terminal emulators — a stale long-running VS Code integrated terminal and a freshly-opened iTerm2. Artifacts + fullnotes.md:docs/incidents/655/captures/2026-05-28/(PR incoming).Findings
scriptrecords exactly the bytes sequant wrote to the pty. Both captures are clean:�) in streamcoatcha/(no commi─overlay in streamESC[?2026h/lsync pairsRenderer self-instrumentation is internally consistent on every frame:
rendererCols != stdoutColslogicalLines > rendererRowsConclusion
sequant's renderer is not corrupting output. It emitted clean, valid, column-correct, atomically sync-framed bytes on two independent emulators. The corruption is downstream of the byte stream, from two distinct causes that both leave
scriptclean:(no commi───┐fragment came from pasting scrollback of a redraw-in-place UI — 5927 cursor-ups in that capture — not a live glitch).This refutes the issue's core premise. Column-mismatch was already refuted (#654/#657); the renderer-emits-bad-bytes hypothesis is now refuted too, with evidence.
Disposition
logUpdateClear/redrawcycles = smaller blast radius for the paint churn a degraded emulator mis-renders).docs(#655): HITL capture — renderer emits clean bytes, corruption is …
admarble commentedon May 30, 2026
Closing as environmental — renderer exonerated with byte-level evidence
Per the disposition above and the merged capture (PR #673, artifacts under
docs/incidents/655/captures/2026-05-28/), closing this as an environmental terminal-emulator defect, not a sequant code bug.Why
scriptrecords exactly the bytes sequant wrote to the pty. Across two independent emulators (stale long-running VS Code xterm.js + freshly-opened iTerm2), the byte stream was conclusively clean — independently re-verified during QA of #673:(no commi─/coatchaoverlay fragments in either streamESC[?2026h/lsync pairs balanced (500/500 vscode, 224/224 iterm2)rendererCols != stdoutCols, 0logicalLines > rendererRowsThe on-screen corruption is downstream of the clean bytes — (1) stale VS Code paint state on a long-uptime integrated terminal, and (2) clipboard flattening of an in-place-redrawing TUI. Both leave
scriptclean. This refutes the issue's core premise; the column-mismatch hypothesis was already refuted (#654/#657), and the renderer-emits-bad-bytes hypothesis is now refuted too.The original ACs (identify the code path, regression test, ship a targeted fix) were premised on a renderer code defect that the evidence shows does not exist, so they are moot.
Follow-up
logUpdateClearchurn so a degraded emulator has a smaller paint blast radius — is tracked in feat(cli): replace start/complete event journal with in-place phase-matrix #672.fix(cli-ui): single-issue live frame renders boxless indented labels (#…
docs(#655): AC-D1 negative result — synthetic harness does not reprod…
docs(#655): fix static-analysis table mode wiring + flag AC-1 mode di…
docs(#655): sweep TL;DR + section heading for `-q`-scoped framing