Skip to content

perf(chat): use TanStack Virtual for transcript windowing - #5089

Merged
reachjalil merged 3 commits into
devfrom
perf/tanstack-thread-window
Sep 17, 2026
Merged

reachjalil merged 3 commits into
devfrom
perf/tanstack-thread-window

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Use the repository's existing @tanstack/react-virtual 3.13.23 to calculate and measure the conversation's mounted window instead of maintaining a custom visible-range algorithm. There is no dependency upgrade or supply-chain policy exception in the final diff.

  • Use real useVirtualizer ranges, stable message-group keys, measured row sizes, two-group overscan, and normal-flow placeholders.
  • Preserve session/width-scoped cached geometry, paged-history reservations, native message ID replacement, Find reveal/rebound, and focus/selection/disclosure retention.
  • Keep existing reading-anchor and session controllers authoritative for scroll writes. TanStack observes actual DOM offsets without overwriting restored anchors on connection.
  • Handle empty first groups, width-observer ordering, and late callbacks after viewport disconnection.
  • Preserve the successfully restored page-anchor identity during measured prepends; new keyboard, wheel, and drag navigation selects a new reading position normally.

No OpenCode, attachment-storage, or image-fetching changes. Whole-group virtualization and deliberate interaction retention remain boundaries: one oversized group or many retained interactions can still contain substantial DOM.

Validation

At 2f2cec7e9961ff3b50c3b29c7c4051d6d2388bd8:

  • Policy-compliant frozen dependency installation passes with the original dependency versions.
  • pnpm --filter @openwork/app exec bun test --isolate tests/progressive-message-list.test.tsx tests/session-scroll.test.tsx: 102 passed, 0 failed, 643 assertions.
  • pnpm --filter @openwork/app typecheck: passed in a clean installed tree at the exact head. An existing local installed tree had conflicting React 18/19 type hoisting; a clean full frozen base install passed, and switching that clean tree to the candidate also passed without package changes.
  • Complete diff review and whitespace checks passed.

Real Electron journey on Daytona

OPENWORK_EVAL_REF=2f2cec7e9961ff3b50c3b29c7c4051d6d2388bd8 pnpm evals:e2e session-full-history-on-open --daytona --strict-ref --engine v1

1 passed, 1 failed, 0 skipped. Runner, prepared sandbox, and post-run source matched the exact head. The temporary environment was deleted and its absence verified.

  • Passed: bounded cold opening, Home/prepend anchor preservation, PageUp older-page persistence, exact cold saved-page restoration, explicit full-history navigation, and the warm-cache refresh scenario.
  • Still under investigation: after clicking the first message and eight PageDown gestures, that offscreen first group remained mounted alongside the bounded visible window and tail. The test expects it to unmount. Focused groups are intentionally retained; the current witness does not identify whether a descendant still held focus. The assertion has not been weakened, and the PR is not being presented as runtime-validated until this is resolved.
  • The final branch-at-first-message step was not reached in the failing scenario. Visual judgments and broader browser/platform coverage are not claimed.

Screenshots

Real Electron captures at 2f2cec7e9, 1180×820, using synthetic stored messages. These demonstrate the rendered interface, not a pass for the remaining row-retention assertion.

Latest messages after cold opening

Latest messages in the virtualized conversation

Original reading boundary after loading an older page

Older page loaded while the original message remains visible

UI/UX impact

None — existing visuals and controls preserved. Paging now consistently saves the intended restored reading anchor. DESIGN P5: existing message primitives and scroll/interaction behavior are retained. DESIGN P10: current-head real-size screenshots are attached above. Screenshots supplement, not replace, the runtime assertions.

@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 17, 2026 3:00am UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 17, 2026 3:00am UTC
openwork-diagnostics Skipped Skipped Sep 17, 2026 3:00am UTC
openwork-landing Skipped Skipped Sep 17, 2026 3:00am UTC

@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 17, 2026 02:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 17, 2026 02:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 17, 2026 02:14 Inactive
@reachjalil
reachjalil enabled auto-merge (squash) September 17, 2026 02:16
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 2. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (111468 ms), confidentiality-review (141387 ms), desktop-den-sync-review (144607 ms), design-spec-review (179656 ms).

Blockers

  • None.

Advisories

  • V47-UFN · low · design-spec-review · apps/app/src/components/chat/progressive-message-list.tsx:55
  • A4L-YPU · low · design-spec-review

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 3
  • Distinct heads in retained window: 3
  • Current unresolved Warden threads: 1 of 1 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 1
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 3/20 run attempts retained; truncated: false
  • Transition snapshot: 1/1 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 17, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (b47561cd42866e353d04534b4ead26b15a8a6312). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 17, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (21f0d7cc3b133f9ec056ec29de7b6f5293b63263). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit 2f2cec7e9961ff3b50c3b29c7c4051d6d2388bd8 · selected evidence

Open review report

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (2f2cec7e9961ff3b50c3b29c7c4051d6d2388bd8). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – openwork-app — 2f2cec7e Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-den — 2f2cec7e Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-diagnostics — 2f2cec7e Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-landing — 2f2cec7e Deployed Sep 17, 2026 by vercel[bot]
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