Skip to content

Window the transcript the reader sees — an idle conversation re-reads its whole history and renders every message on each switch today, so the older a conversation gets, the slower it opens #201

Open

Description

@bencode

Problem

A conversation's stored transcript only ever grows: messages are appended (appendStoredConversationMessages, ui-packages/web/src/data/conversation-store.ts:84-108) and nothing trims them — compaction bounds the model's context, not the record a reader reopens. An idle conversation leaves memory on switch (letGo/releaseSession, ui-packages/web/src/features/conversation/use-conversation/navigation.ts:53-56), so every switch back re-reads the whole history — getStoredConversation does getAll on the message index and sorts it in memory (conversation-store.ts:61-76) — and attachAgent plus displayMessages then feed every message to the panel, which renders them all with no windowing (ui-packages/web/src/features/conversation/conversation-messages.tsx:177-189; memoization at :141-142 protects typing in the composer, not the size of the list).

The product's own framing is "weeks of questions and answers" living in one conversation (#50), and background answering (#198) makes switching between several long-lived conversations a routine move. Yet the assistant panel is the one large list in the app with no window: the Files tree got that diagnosis as #166, the sheet grid virtualizes its rows (useVirtualizer, xlsx-reader/sheet-grid.tsx:34-39) and clamps its columns — a 2,000-message transcript renders 2,000 message components and re-reads them all from IndexedDB on every visit, so the older a conversation gets, the slower it opens and the heavier it is to scroll.

Proposal

  • Render a window of the transcript: the last screenfuls of messages, with older ones read and mounted as the reader scrolls up — the same treatment the sheet grid already gives its rows.
  • The full transcript stays in storage untouched; compaction continues to bound the model's context only.

Goal

After this, opening or switching back to a conversation takes the same time and memory whether it holds 20 messages or 2,000: the panel renders the messages on screen, and older messages appear as the reader scrolls up rather than being mounted up front.

Verification

grep -rEq "useVirtualizer|visibleMessages|windowed" ui-packages/web/src/features/conversation/conversation-messages.tsx
pnpm --filter @gamma-reader/web test --silent
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 23, 2026
  2. bencode commented on Oct 23, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Evidence audit (HEAD da3dfad): confirmed, every anchor exact. getStoredConversation does getAll + in-memory sort (conversation-store.ts:61-76); storage is append-only — the sole message deletion is whole-conversation removal (:134-143), no trim path exists; letGo/releaseSession (navigation.ts:53-56) means every switch back re-reads (switchTo :133-158); attachAgent takes all stored messages (agent-session.ts:93-99); the panel maps every message unwindowed (conversation-messages.tsx:177, memo at :141-142 protects composer typing only); the sheet grid's useVirtualizer precedent is at sheet-grid.tsx:34-39. Referenced issues check out: #166/#175 open, #70/#50 closed, PR #198 merged in da3dfad.

    Duplicate check: none across open + closed titles (#166/#175 are cross-referenced family, different surfaces).

    Sensor: lint ✓ · verify ✗ (expected — no windowing in the panel yet).

    Sharpening:

    • Scope note: the render window fixes render cost, but the Goal ("same time at 20 or 2,000") also depends on the read path — readConversation → getAll still scales with history on every switch, and attachAgent's rawMessages needs the full (or compacted) transcript for context. Say explicitly whether the first cut windows only the render and accepts the re-read, or windows the read too.
    • The verification grep is a presence check; the outcome anchor is: seed ~500 stored messages, render, assert mounted message components stay at window size and grow on scroll-up (jsdom needs the virtualizer measurement mocked — same treatment any sheet-grid test uses).

    Valid; stays open.

  3. bencode commented on Oct 25, 2026

    @bencode
    OwnerAuthor

    Independent re-review — posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audited at HEAD 90b046f. Commits since the last review (93563a2, merge #203) touch only ui-packages/web/src/styles.css (resource-row hover overlay) — none of the surfaces this proposal cites.

    Evidence audit: all anchors still exact — conversation-store.ts:61-76 (getStoredConversation = getAll + in-memory sort), :84-108 append-only (sole deletion remains whole-conversation removal at :134-143), navigation.ts:53-56 + switchTo :133-158, agent-session.ts:93-99, conversation-messages.tsx:141-142/177-189 (full unwindowed messages.map), sheet-grid.tsx:34-39 precedent.

    Sensor: lint ✓ · verify ✗ (still unimplemented, as expected).

    Duplicate check: clean (open + closed); #166 remains a different surface.

    Verdict unchanged: valid, stays open. Sharpening from the prior review (read-path scope note; outcome-based Verification anchor over the presence grep) still applies.

  4. bencode commented on Oct 27, 2026

    @bencode
    OwnerAuthor

    Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session. Against main@dbf9cb6d (~35 commits since the last review at 90b046f; two land in this issue's own files — a38c02d tab-death persistence, aacecc0 failure notices — neither windows or trims anything).

    Evidence audit: premises hold; anchor drift throughout the Refs.

    • ✅ conversation-store.ts:61-73 — getStoredConversation still getAll on the message index + in-memory sort; appendStoredConversationMessages still :84; storage still append-only, no trim.
    • 🔁 navigation.ts:61-63 — letGo (cited :53-56, +8). Note the premise survives the background-reply work precisely: letGo releases only non-busy sessions, and this issue's claim is about idle conversations — those still leave memory and re-read on switch back.
    • 🔁 switchTo now :153 (cited :133-158, +20).
    • 🔁 agent-session.ts:99-103 — attachAgent (cited :93-99, +6); runtime.rawMessages = [...storedMessages] at :103.
    • 🔁 conversation-messages.tsx — unwindowed messages.map now at :214 (cited :177-189); memo now :179. CompactionDivider at :216 confirms compaction stays model-side: every message still renders.
    • 🔁 precedent moved: useVirtualizer now at reader/xlsx-reader/sheet-grid.tsx:94 (cited :34-39, path gained xlsx-reader/).

    Verification block still discriminates: useVirtualizer|visibleMessages|windowed has zero matches in conversation-messages.tsx at HEAD.

    Duplicate check: clean (open + closed); #166/#175/#233 remain different surfaces.

    Sensor: lint ✓; verify ✗ → not implemented on main.

    Verdict: valid, keep open. Prior sharpening unchanged: decide whether the first cut windows only the render (accepting the re-read) or the read too, and prefer the outcome anchor (seed ~500 messages, assert mounted components stay at window size, grow on scroll-up) over the presence grep.

  5. bencode commented on Nov 2, 2026

    @bencode
    OwnerAuthor

    Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session. Against main@d05b6b6 (4 commits since the last review at dbf9cb6; two land in this issue's own files — the plugins feature de9243b grows navigation.ts but only to load/refresh plugins on startup and visibility; it windows and trims nothing).

    Evidence audit: premises hold; one line drift.

    • ✅ conversation-store.ts:62-76 — getStoredConversation still getAll on the message index + in-memory sort; storage still append-only (the only messages delete, :140, is inside whole-conversation removal).
    • ✅ navigation.ts:62-63 — letGo releases only non-busy sessions; the idle-conversation premise survives the new visibility work.
    • 🔁 switchTo now :170 (cited :153, +17 from the plugin refresh additions).
    • ✅ agent-session.ts:99-103 — attachAgent takes all stored messages (runtime.rawMessages = [...storedMessages] at :103), exact.
    • ✅ conversation-messages.tsx:214 — unwindowed messages.map, exact; precedent useVirtualizer still at reader/xlsx-reader/sheet-grid.tsx:94.

    Verification block still discriminates: useVirtualizer|visibleMessages|windowed has zero matches in conversation-messages.tsx at HEAD.

    Duplicate check: clean (open + closed); #166/#175/#233 remain different surfaces.

    Sensor: lint ✓; verify ✗ → not implemented on main.

    Verdict: valid, keep open. Prior sharpening unchanged: decide whether the first cut windows only the render (accepting the re-read) or the read too, and prefer the outcome anchor (seed ~500 messages, assert mounted components stay at window size, grow on scroll-up) over the presence grep.

  6. bencode commented on Nov 14, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit @ `d05b6b6` — fourth pass, quiet window (0 commits since the last re-audit at the same HEAD on 2026-11-02; newest filings #294/#295 touch other surfaces). Still valid; stays open; no edits.

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

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions