Repository navigation
Description
Context
Spun out from #647 AC-4 per its own instructions: "If independent, file a separate issue with full repro and link back here. Do not bundle into the §3 fix."
While addressing #647 (duplicate-header bug), the same motivating transcript surfaced two additional rendering symptoms that are not explained by the duplicate-header mechanisms. Per #647 spec AC-4, they may or may not share a root cause; independent diagnosis is required before that determination.
Symptoms (from #647 transcript, npx sequant run 504 505 -q, v2.3.0)
Symptom A — missing characters mid-string
✘ #505 qa QA verdict: AC_MET_BUT_NOT_A_PLUS
▸ #505 loop
✔ #5loop Claude Code returned an error result: ...
✔ #5loop should be ✔ #505 loop. Characters 05 are missing from the middle of the event line. This is NOT a clearing artifact — characters vanished mid-string after the line was already written. Likely candidates:
- Overwrite from concurrent live-frame redraw landing on a partial event line
appendEventLine(src/lib/cli-ui/run-renderer.ts:649-691) racing with renderer state mutation when the loop phase starts- String-slicing bug in event formatting
Symptom B — U+FFFD in summary table
├───────� │ 33m 41s │
A border row visually overlaid with a data row, with U+FFFD (replacement character) in the middle. Most likely in TTYRenderer.renderSummary (now run-renderer.ts:704) teardown path — non-UTF-8 byte emitted into a UTF-8 stream, or truncation at a multibyte boundary.
Why this is filed separately
The #647 issue's AC-4 explicitly required: "If neither shares a root cause with AC-1's mechanism, file a new issue with verbatim repro and link back to #647. Do not bundle into the AC-3 PR."
Without AC-1 production-instrumentation evidence yet captured (the AC-1 instrumentation infrastructure landed in the #647 PR but has not been replayed against a live duplicate-header run), shared-root-cause cannot be confirmed. Filing this issue keeps the corruption symptoms tracked independently while #647 focuses on the primary scrollback bug.
Acceptance criteria
- Reproduce Symptom A in a controlled scenario (small parallel run with a QA loop iteration that triggers the
loopphase event). Document conditions. - Reproduce Symptom B by triggering a run that completes the summary table render under realistic terminal interleaving.
- Diagnose each independently: instrument the renderer (extend fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647's
SEQUANT_DEBUG_RENDERER=1JSON-lines output if useful) to capture the exact event-line / frame-write / cursor-state sequence that produces each symptom. - Decide shared vs independent root cause after both reproductions. If shared with fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 Mechanism feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1: fold into a follow-up PR on top of fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647's fix. If independent: ship a targeted fix here.
- Fix + regression test in the scrollback harness (
src/lib/cli-ui/scrollback-harness.test.ts) that captures the symptom before fix (RED on the base commit) and after (GREEN).
Out of scope
- Duplicate-header bug — tracked in fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647
--experimental-tui(Ink) renderer — separate code path
Related
- fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 — parent issue, AC-4 source
- feat(cli): run renderer follow-ups — frame stability, attempt counter, summary teardown (#618 follow-up) #624 — predecessor (false-green fix)
- feat(cli): unified run renderer — two-zone live grid + events #618 — original renderer
Activity
admarble commentedon May 15, 2026
Plan Complete (
/fullsolve)This is a diagnose-first renderer issue. The plan below treats reproduction as the prerequisite for any fix.
Hard dependency on #647
AC-5 explicitly requires
src/lib/cli-ui/scrollback-harness.test.ts— that file is introduced by PR #653 (issue #647) and does not yet exist onmain. AC-3 also references #647'sSEQUANT_DEBUG_RENDERER=1instrumentation.Decision: Worktree is branched from
feature/647-fix-cli-624-s-duplicate-header-fix-doesn-t-catch-rrather thanmain. If #647 merges first → rebase onto main (clean). If #647 is reworked → cherry-pick the harness files into #652's PR.AC checklist
✔ #5loopmid-string char loss) inscrollback-harness.test.ts— assertgetAllText()contains#505 loop, not#5loop.�ingetAllText()and that separator rows contain no digits/letters.SEQUANT_DEBUG_RENDERER=1instrumentation inappendEventLineandrenderSummarycapturing cursor pos, log-updatepreviousLineCount, and write boundaries.Working hypotheses (subject to AC-3 evidence)
appendEventLine'slogUpdateClear()relies on log-update'spreviousLineCount, which under-counts when prior event lines exceeded terminal width. The next event-line write lands on a row that still has stale chars from the previous frame, eating chars mid-string when the new shorter line writes over a wrapped longer one.renderSummary,clearInterval(this.liveTimer)runs afterlogUpdateClear/logUpdateDone. The live-tick interval can fire between those calls, re-rendering the live frame into the output stream, splitting a multibyte box-drawing char at a byte boundary → U+FFFD.Implementation plan
src/lib/cli-ui/run-renderer.tsand extendsscrollback-harness.test.ts.SEQUANT_DEBUG_RENDERERJSON-lines emitter.appendEventLine; or fixpreviousLineCountwrap math.renderSummarytoclearIntervalfirst, then clear/done log-update; or emit summary line-at-a-time so an interleaving write can't split a single line at a multibyte boundary.HEAD~1(orgit stashthe fix) and pass after.Open questions (proceeding with recommended defaults)
claudesubprocess vs synthetic events? → Synthetic events only (fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 pattern); avoid live AI calls.Workflow
Phases: spec → exec → qa (no browser test —
uihere means terminal UI)Quality loop: enabled (
complexlabel)admarble commentedon May 15, 2026
admarble commentedon May 15, 2026
QA Review (
/fullsolve)AC Coverage
Coverage: 5/5 ACs met
Fixes
TTYRendererconstructor: replace the unboundlogUpdatesingleton withcreateLogUpdate(boundStream), whereboundStream.columns/rowsgetters delegate to the renderer'sgetColumns()/getRows(). Closes theprocess.stdout.columns === undefinedmismatch window undernpx.renderSummaryteardown reorder:clearInterval(liveTimer)now runs beforelogUpdateClear/Done, so no pending tick can interleave between teardown and summary write.Tests
scrollback-harness.test.ts(340 lines)Known Limits (documented in PR description)
setIntervalpreemption, so the visible-symptom tests pass on both pre- and post-fix code. The RED→GREEN gates are property invariants (column binding, call order) tied to the documented mechanism.SEQUANT_DEBUG_RENDERER=1against the original transcript would validate the column-mismatch hypothesis; not performed here.Verdict
AC_MET_BUT_NOT_A_PLUS — All ACs met with explicit caveats. Defensive fix is well-motivated and matches the issue's "likely candidates"; ship as a follow-up on top of #647 per the issue body's instructions.
Follow-ups (not blocking)
SEQUANT_DEBUG_RENDERER=1to validate the column-mismatch hypothesis empiricallyadmarble commentedon May 15, 2026
/fullsolveCompleteStatus: READY (with caveats)
Summary
Iterations
Risk Assessment (from QA self-evaluation)
claudesubprocess), this fix won't address it. Verdict: medium confidence; ship as defensive fix.Next Steps
fix(#652): address PR review gaps — isTTY, theater claim, misleading …
admarble commentedon May 16, 2026
Gap-fix update on #654
Four adversarial reviewers found gaps in the original PR. All HIGH-severity findings addressed in commit
89fb02aand reflected in PR #654's rewritten description.What changed
isTTY: truehardcoded → ANSI pollution under pipesget isTTY() { return Boolean(process.stdout.isTTY) }_boundStream.columns/isTTY(private field)logUpdateClearwas actually calledWritableStream)Honest reframing
The new PR description acknowledges:
Still RED→GREEN
Both invariants verified RED on pre-fix code by reverting each fix locally:
_boundStream = null→ "expected null not to be null"clearIntervalto afterclear/done→ "expected true to be false"All 91 cli-ui tests pass on post-fix code; lint clean.
Recommended follow-ups (filed in PR description, not blocking)
SEQUANT_DEBUG_RENDERER=1to validate the column-mismatch hypothesisadmarble commentedon May 16, 2026
Investigation update — PR #654 closed; tracking continues in #655
Post-merge of #647, eight parallel agents investigated this issue:
wrapAnsibakes\ninto the output, sopreviousLineCountalways matches the terminal's row count regardless ofstream.columns.ESC[2Kper changed line, no partial overwrites.claudesubprocess writes to stdout in non-verbose mode (the user's case here:-q). The SDK runs in-process and captures all output.complete_line[0:8 bytes]+failed_line[col 9 onward]— but no proven single-process mechanism produces it.The actual cause remains unknown. Investigation continues in #655 with all ruled-out hypotheses listed up-front so future work doesn't relitigate them.
Side find filed as #656:
TTYRenderer.pause()/resume()are dead code in production becausebatch-executor.tsnever passes thespinnerargument. Affects--verbosemode rendering integrity. Unrelated to the symptoms here but discovered along the way.This issue stays open — the production bug is real and unfixed. Closing only after a targeted fix lands.
admarble commentedon May 17, 2026
Closing as superseded — the umbrella has been split into three focused issues:
SEQUANT WORKFLOW ·headers in scrollback). AC-1 evidence captured today (see PR landing underdocs/incidents/647/captures/2026-05-17/); Mechanism feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1 confirmed at 2,181× over a 36m run.complete[0:8] + failed[9:]byte-math overlay, e.g.✔ #5loop). AC-D1 negative result merged (docs(#655): AC-D1 negative result — synthetic harness does not reproduce #657); AC-1..4 still deferred awaiting a Symptom-A-specific capture (the AC-1 capture for fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 did not contain this byte-math pattern).SEQUANT WORW · #658 · 35m 7s elapsed, distinct from investigate(cli): #652 renderer corruption — column-mismatch hypothesis refuted, real cause unknown #655 Symptom A's byte-math signature). Will be filed once fix(cli): #624's duplicate-header fix doesn't catch real log-update/scrollback bug (v2.3.0 regression confirmed) #647 transitions to "fix" phase.PR #654's defensive column-binding fix was refuted by post-#647 adversarial review; that work is preserved on
feature/652-fix-cli-renderer-bottom-outputif any of it becomes useful once Mechanism #1's fix lands.No code lives under this issue; closing to keep the cluster traceable through the three focused successors.
fix(#652): renderer bottom-output corruption — column-binding + rende…
test(#652): add RED→GREEN column-mismatch invariant for Symptom A
fix(#652): restore renderer fixes accidentally reverted in 95c136f
fix(#652): address PR review gaps — isTTY, theater claim, misleading …