Skip to content

fix(terminal): preserve replay and history ownership - #193

Closed
Lint111 wants to merge 2 commits into
Ark0N:masterfrom
Lint111:agent/split-terminal-lifecycle
Closed

fix(terminal): preserve replay and history ownership#193
Lint111 wants to merge 2 commits into
Ark0N:masterfrom
Lint111:agent/split-terminal-lifecycle

Conversation

@Lint111

Copy link
Copy Markdown
Contributor

Summary

  • keep session selection in control of its buffer-load transaction across cached and canonical replay
  • keep manually scrolled terminal history anchored until the reader actually returns to the bottom

Root causes

chunkedTerminalWrite() always finished the buffer-load gate, even when selectSession() supplied and still owned that gate. Live terminal output could therefore resume between restoration stages and interleave with a later replay.

Manual scroll protection also expired after 1.5 seconds. A busy Codex status redraw could reclaim the viewport while the user was still reading older output.

What changed

  • nested replay uses the caller's owner token without beginning or finishing that transaction
  • standalone replay retains its existing self-owned behavior
  • upward wheel/touch scrolling locks the viewport
  • writes preserve the exact xterm viewport while that lock is active
  • downward scrolling releases the lock only after xterm reports the bottom

Commit structure

  1. fix(terminal): retain session replay ownership
  2. fix(terminal): keep manual history scroll anchored

Validation

  • npx vitest run --config config/vitest.config.ts test/terminal-flush-budget.test.ts test/terminal-buffer-flush.test.ts test/codex-snapshot-replay.test.ts (19 tests)
  • npm run typecheck
  • npm run lint
  • npm run check:frontend-syntax
  • npm run check:public-assets
  • npm run build
  • Prettier and git diff --check

Scope

This PR does not include terminal streaming, warm-session caching, viewport ownership, keyboard layout settling, or authoritative frame capture.

@Ark0N

Ark0N commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Hi Lior, closing this one as part of a cleanup of the seventeen PRs currently open from you. The full explanation is in #173, and I would rather you read that one than this note, because it is the honest version and it is not a dismissal of your work.

The short form: sixteen PRs opened in a single day, roughly 42,000 added lines in total, landing mostly on the same few files (nine touch app.js, eight touch terminal-ui.js), with five already conflicting against master and none carrying CI results. I cannot review that at the standard this codebase needs, and merging it at a lower standard would be worse than not merging it.

Going forward, please keep no more than three open PRs at a time, each one a single behavior change that stands on its own, with a test that fails on master and passes with the fix. #214 and #215, merged today, are good models.

If this particular change fixes something that genuinely annoys you in daily use, it is a good candidate to be the first one you reopen on its own, rebased on current master. I will review it properly.

Thanks for the effort you put in, and sorry to close it this way.

@Ark0NArk0N closed this Aug 5, 2026
Sign up for freeto 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

@Lint111@Ark0N