Skip to content

Present Windows transcript replay in one terminal update - #13

Closed
astral303 wants to merge 1 commit into
fix/30745-windows-scrollback-reflowfrom
fix/38839-windows-terminal-reflow-transaction
Closed

Present Windows transcript replay in one terminal update#13
astral303 wants to merge 1 commit into
fix/30745-windows-scrollback-reflowfrom
fix/38839-windows-terminal-reflow-transaction

Conversation

@astral303

Copy link
Copy Markdown
Owner

Depends on #6.

What Changed

  • Treat the pending clear target and source transcript rows as one InlineViewportState transaction.
  • Clear exposed scrollback, update viewport geometry, replay history, draw the frame, and reconcile state inside one synchronized terminal update.
  • Retain the transaction until every terminal write succeeds, so clear, replay, or draw failures retry the complete operation.
  • Pre-wrap replay rows and buffer each history insertion before presentation, keeping expensive work outside Windows Terminal's synchronized-output window.

Design

Tui still orchestrates drawing. InlineViewportState owns the Windows-specific replay mechanics and retry state, extending the platform facade introduced by the openai#30745 stack without adding platform branches to tui.rs.

The clear -> replay -> redraw ordering comes from wellorbetter's candidate. This version also keeps the complete operation retryable and prepares reflowed output before entering the synchronized update.

Validation

  • Deterministic tests cover ordering and retries after clear, history-write, and frame-draw failures.
  • A real 120x30 Windows Terminal capture with 1,500 long history rows and three resize cycles failed on the previous implementation and passed repeatedly with this change.
  • The full non-ignored codex-tui suite passed 3,633 tests; its three existing Windows ~ path-shortening failures remain unchanged.

Addresses openai#38839.

Stack

#6 source-backed reflow -> this production fix -> #7 interactive Windows tests

Windows Terminal can expose a cleared or partially replayed frame when
resize repair spans its 100 ms synchronized-output window.

- Keep the clear target and source rows pending until clear, replay, draw,
  and reconciliation all succeed, so I/O failures retry the complete
  transaction.
- Pre-wrap replay rows before synchronized output and buffer each history
  insertion before its backend write, keeping expensive preparation outside
  the presentation window.
- Defer history-tail replacement while replay is pending so asynchronous
  status updates cannot split the transaction.
- Cover ordering and retries after clear, history-write, and frame-draw
  failures.

Refs: openai#38839
@astral303

Copy link
Copy Markdown
Owner Author

Closing this implementation because it depends on the retired openai#30745 InlineViewportState architecture superseded by openai#39619. This does not resolve openai#38839; that issue still needs reassessment against the current ScrollbackStrategy architecture.

@astral303 astral303 closed this Aug 21, 2026
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.

1 participant