Skip to content

to-human: a resumed history's raw rows are the engine's scrollback (board #105) - #286

Merged
SSFSKIM merged 2 commits into
mainfrom
to-human-105-resume-scrollback
Oct 20, 2026
Merged

SSFSKIM merged 2 commits into
mainfrom
to-human-105-resume-scrollback

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Board #105: after claude --resume, a session's marked history drew raw (⏺ <message>…) instead of folding into the to-human report view.

Cause

The engine causes this, and none of the ticket's three candidates is quite it.

  1. Rows rendered before the module registered: yes, but that alone is not the bug. On a --resume start, Claude Code (2.1.304) draws the resumed transcript in its first frame before the plugins' hooks modules load. A live run measured the raw text on screen 0.8 s before hooks module to-human … loaded. Once the module loads, the engine bumps the render version (tWn()) and asks to-human about every mounted row again, so this candidate does not explain lasting raw rows.
  2. native() passing them through: no. On the terminal surface it returns false.
  3. hasSeenMark never set from history: no. An instrumented copy of the mod logged its first answer about every history row as folding: seen=true folding=true on the very first call.

What stays raw is the terminal's scrollback. On the main screen (the default, not tui: "fullscreen"), rows that the first frame pushed past the screen's top are in scrollback, and the renderer never writes them again:

  • its diff skips a changed cell above the screen (ye < Q in cli.pretty.js ~862260);
  • its full reset (Al() / eot()) clears and repaints only the screen's rows.

Resizing, Ctrl+L and a new marked message all leave those rows raw; each was observed live. Rows still on the screen fold as soon as the module answers. In fullscreen the whole alternate screen is repainted, and the history folds right up to its first row.

A hook cannot reach the scrollback, and the mod API has no way to reprint it, so this PR changes nothing in to-human. The fix belongs in the engine. It could load hooks modules before the first transcript frame, or hold a row that a not-yet-loaded module will draw, the same way it already holds a hooked row whose answer is pending (drawPending). The owner runs tui: "fullscreen", where this does not happen.

I could not reproduce one claim from the rehearsal: that everything folds after the next marked message. In every main-screen run the scrollback stayed raw after a new message. Every other case I tried folded right after the module loaded: a short history, a module loading 4 s late, an in-session /resume, and doperpowers loaded alongside.

What this PR adds

  • to-human/tests/mods/to-human.test.ts: a resumed marked row folds from the module's first answer, with no earlier mark. This pins the view's side and rules out candidates 2 and 3.
  • to-human/tests/mods/live-resume-check.py: the engine's side, live, in a temporary HOME driven through tmux. It makes a two-message history (two haiku calls), then resumes it on the main screen and in fullscreen. It checks that the first frame comes before the module loads, that the module is asked about the long row, that the band is on, that on-screen rows fold, that the scrollback head stays raw, and that fullscreen folds to the top. The scrollback check fails, naming docs(sminos): design spec — the human stream #105, on the day the engine starts repainting scrollback. A run against 2.1.304 passed all 6 checks.

No version bump: nothing a session loads has changed.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)

The cause is the engine's, not the view's. On a --resume start the engine
draws the resumed transcript in its first frame, before the plugins' hooks
modules load (0.2 to 1 s later), so that frame is its own drawing. Once
to-human loads, the engine asks it about every mounted row, and the view
folds them all from its first answer: the history's marks turn it on
(hasSeenMark is set from history), and native() passes nothing on the
terminal. On the main screen, though, the rows the first frame pushed past
the screen's top are in the terminal's scrollback, which the renderer never
writes again: it skips a changed cell above the screen, and its full reset
repaints the screen's rows alone. They stay raw for good, a new marked
message included. Fullscreen repaints the whole alternate screen, so there
the history folds to its first row.

No hook reaches the scrollback, so nothing in to-human changes. The unit
test pins the view's side (a resumed marked row folds from the module's
first answer); live-resume-check.py pins the engine's (first frame before
the module, scrollback raw on the main screen, folded in fullscreen), and
fails the day the scrollback comes out folded.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
- The unit test counts the engine's own drawings for the row, so a first
  answer that came out raw fails it even though the kit redraws the
  invalidated mount before a find reads it (a mutant that folds only on
  the redraw now fails).
- The live check unlinks the env file before anything else in cleanup,
  tolerates a missing tmux, and runs the cleanup on SIGTERM and SIGHUP.
- It matches the engine's bullet off macOS (● there, ⏺ on macOS), and
  says "changed" only when a raw first frame was seen.
- The fullscreen check proves it reached the history's top.

Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
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