Skip to content

Open History without exhausting text-measurement capacity #1220

Closed

Description

@taras

Story

Opening History in a large saved REPL session must keep the interface usable and every recorded position reachable, without running recorded work or changing the saved history.

Current gap

After #1217 merged, the reported session opens, but clicking History crashes before the drawer becomes visible, with:

ReplRenderError: the frame does not fit the layout engine even after rebuilding it:
TEXT_MEASUREMENT_CAPACITY_EXCEEDED

The failure is reported on merged commit 79abfdaafef01442ccc236002f45da86e1e95c6e, from renderer.ts draw through commitReplFrame. The session has 79 entries and the supplied screenshot shows a tall terminal with the transcript and Sidekick visible; exact cell dimensions are being established. The earlier full-session rendering witness tested the initial view at 316×40, while the History journey used a small synthetic history. Neither established this full-session History-click path.

A read-only production-frame reproduction now confirms: for the reported 79-entry record, initial view and History both succeed at 316×40; at 316×80 the initial view succeeds but opening History fails with the same error, including the retry with a fresh drawing engine. These are reproducing dimensions, not a claim about the original window’s exact cell size.

Cause established

History controls combine each label with enough trailing spaces to fill its clickable row. At wide, tall sizes, distinct padded labels exhaust Clay’s measured-word storage in a single drawing frame. A diagnostic separation of each label from its padding preserves every displayed byte and permits the padding to reuse cache entries; both the public synthetic case and the safe full-record click then complete without engine replacement.

The same public reproduction fails with the verified published tty 0.9.0 payload and passes with that diagnostic separation. This capacity defect therefore also exists with the old engine; the earlier cache-identity repair remains necessary.

Acceptance

  • Reproduce the History transition using a read-only copy of the reported record and the production frame renderer; record the tested terminal dimensions and exact source/payload identities privately. Leave the original session untouched and never execute its entries or agents.
  • Add a public synthetic regression that fails on the merged version and exercises the same capacity boundary through opening History. Establish the actual cause before selecting the repair.
  • The repaired History view opens and supports selection, paging and closing for the large record at the reproducing size and a representative supported size. Every recorded position remains reachable, with correct measured layout and complete source text.
  • Cold inspection/navigation starts no provider, reruns no work and appends no history. Existing immutable frame observations, engine ownership/reuse and valid refusal behavior remain intact.
  • Do not hide the failure by truncating history, suppressing width/capacity errors or adding an unexplained global limit increase. Keep the repair focused on the demonstrated cause.

Verification

Extend the relevant History journey in packages/cli/tests/repl-journey.test.ts and any focused renderer regression needed for the demonstrated boundary. Preserve the first failing output, a discriminating red/green synthetic witness and safe full-record History-click evidence. Required CI remains the delivery gate. Private session text and the screenshot do not belong in public fixtures.

Related: #1216 was the earlier cache-collision failure; #1218 tracks eventual removal of the local tty vendor route. This report does not yet establish that the new failure is another upstream cache defect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions