Skip to content

fix(tui): preserve restart admission after repaint failure - #3686

Merged
Yeachan-Heo merged 2 commits into
Yeachan-Heo:devfrom
snowykr:fix/restart-viewport-admission
Jul 31, 2026
Merged

fix(tui): preserve restart admission after repaint failure#3686
Yeachan-Heo merged 2 commits into
Yeachan-Heo:devfrom
snowykr:fix/restart-viewport-admission

Conversation

@snowykr

@snowykr snowykr commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #3684.

Problem

A temporary TUI stop/start can append rows produced while stopped before repainting the live viewport. The append reaches native scrollback first, but the durable frontier was previously advanced only after the subsequent viewport repaint succeeded.

If that repaint write failed or the terminal detached, a later restart retained the old frontier and appended the already-admitted rows again.

Reproduction

  1. Start a process-terminal TUI with an existing transcript.
  2. Stop it and append rows while stopped.
  3. Restart it, allow the suffix append write to succeed, then fail the following viewport repaint write.
  4. Restore the terminal and restart again.

Expected: each stopped row remains admitted exactly once.
Previous behavior: the old durable frontier caused the second restart to emit the stopped suffix again.

Change

Advance both the durable frontier and retained restart baseline immediately after the suffix append write succeeds. The subsequent viewport repaint remains responsible only for displaying the frame; its failure cannot re-admit bytes that already reached native scrollback.

Verification

  • Added a deterministic restart-retry regression using a faulting process-terminal wrapper: the append succeeds, the following viewport write fails, and every stopped row is asserted exactly once after recovery.
  • Focused TUI suite: 184 passed, 0 failed, 1,789 assertions.
  • bun --cwd=packages/tui run check passed.

Scope

Only packages/tui/src/tui.ts and packages/tui/test/render-regressions.test.ts change. This is a follow-up to review feedback after the upstream transcript-loss PR merged; it targets the fork's dev branch only.

Base: eacf5345a1e9cf658a58f7cef0c06e79d4448e59
Head: 610c256ca386985076f2beee85e7e09b866dd59b

snowykr added 2 commits August 1, 2026 04:18
A successful restart suffix write was only recorded after the following viewport repaint. A repaint failure could therefore append the same rows again on the next restart.

Advance the durable frontier immediately after the suffix reaches native scrollback and cover the failed repaint retry.

Lore-id: tui-restart-admission
Confidence: high
Scope-risk: narrow
Reversibility: trivial
Tested: focused TUI render and restart recovery suites
The restart admission fix changes user-visible terminal behavior and must appear in the next package release notes.\n\nLore-id: tui-restart-changelog\nConfidence: high\nScope-risk: narrow\nReversibility: trivial\nTested: packages/tui check
@Yeachan-Heo

Copy link
Copy Markdown
Owner

Hostile disposition: MERGE_READY — existing TUI owner lane

Exact head 77a4b1d successor is current against dev eacf5345; terminal product CI is green: 14/14, 0 red, 0 pending in the available census. This follow-up is correctly scoped to the existing #3684 TUI/native-scrollback owner and does not create a duplicate review owner.

Hostile review of the restart-admission invariant: rows appended while stopped are admitted to native scrollback before repaint; the durable frontier is advanced at the admission boundary rather than after the repaint write, so a failed/detached repaint cannot cause duplicate suffix append on the next restart. The regression test covers the stop/append/restart, successful suffix append, failed viewport repaint, restore, and second restart sequence. Changelog coverage is present. No #3665 NotificationServer overlap or #3675 ordinary-ask premise scope is introduced; no P0/P1 found.

Merge is authorized only after the exact current-head CI is terminal green. No merge performed by this review lane.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo
Yeachan-Heo merged commit 4c6e817 into Yeachan-Heo:dev Jul 31, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants