Skip to content

perf(chat): keep long conversations in a bounded rendering window - #5082

Merged
reachjalil merged 3 commits into
devfrom
perf/bounded-thread-rendering
Sep 17, 2026
Merged

reachjalil merged 3 commits into
devfrom
perf/bounded-thread-rendering

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Long conversations previously mounted additional message groups until the entire transcript stayed in the DOM. Keep only a measured viewport window so scrolling through history does not retain every previously visited row.

  • Reuse the existing whole-group renderer, placeholders, and pre-mutation reading-anchor reconciliation with 480px overscan rather than introduce another scrolling system.
  • Replace offscreen groups with their measured heights, retaining session-and-width-scoped geometry and prefix/suffix reservations for paged history.
  • Preserve replacement group identity, the latest/priority groups, streaming updates, focused controls, text selections, linked popup focus, and deliberate disclosure changes.
  • Temporarily reveal history for Find, then restore a bounded window at the current reading position when Find closes.
  • Save only contiguous reading-window geometry and distinguish virtual gaps from unloaded page boundaries.
  • Extend the existing full-history journey to assert bounded DOM and removal of previously visible rows. Image fetching and scheduling are outside this change.

Review fixes

  • Older paging now finds the actual loaded boundary even when the first groups are virtualized or preceded by reserved history. If the destination is still a virtual gap, defer the request until its reading anchor is mounted, then retain that anchor across the prepend.
  • Top navigation no longer reports completion while the destination is an empty virtual gap. It waits for the mounted window and saves the first-message anchor.
  • Strengthen the existing journey with consecutive visible rows, no visible virtual gaps, exact ordered contents of the initial and restored 24-message pages, duplicate checks, and an explicitly visible warm-return anchor before drift can pass. The transcript query returns at most 30 messages; checks for larger loaded windows compare that returned tail as well as the total count and visible window.

Testing

Current head: 4d5051eb5. The fixes were pushed normally on the existing base; no rebase or history rewrite was performed after dev advanced in a separate file.

Passed:

  • Three focused controller regressions first failed on the original implementation: two older-page boundary cases and premature top-navigation completion. They pass with the fix, including anchor preservation across the deferred prepend.
  • pnpm --filter @openwork/app exec bun test --isolate tests/progressive-message-list.test.tsx tests/session-scroll.test.tsx — exit 0; 81 passed, 0 failed, 0 skipped; 472 assertions. Run on the product change at aa469e8ba; the subsequent commit changes only the E2E assertions. Component coverage includes 1,600 groups, tall viewports with short rows, old-node removal, cached heights, width changes, prepends, reserved history, Find, streaming, optimistic/native identity, focus/selection/disclosure state, and Strict Mode cleanup.
  • pnpm --filter @openwork/app typecheck — exit 0 on the product change; product source is unchanged by the final test-only commit.
  • pnpm --dir evals typecheck — exit 0 after the final assertion changes; 473 eval source files checked.
  • git diff --check — exit 0.

Local preview and screenshot:

  • Launched an isolated local app-web preview from clean product head aa469e8ba, with fresh browser state and 150 synthetic messages stored through the real native engine. No provider request or paid infrastructure was needed.
  • Top navigation completed with the earliest message mounted, fewer than 40 message nodes, and no virtual placeholder intersecting the viewport. Captured the real 1280×900 renderer below; checked dimensions, nonblank content pixels, and visible layout. The final test-only commit does not change the captured product source.
  • A later deep-scroll capture attempt stopped before its click because the text locator failed the hit test. That extended capture script exited 1; it is not a passing journey or deep-scroll result. Only the verified top-view image is attached. The owned preview was shut down.

Other checks and gaps:

  • The full updated session-full-history-on-open runtime journey was not run. The screenshot is supplementary and does not establish Electron, cold page restoration, native scroll anchoring, or the full paging journey. No new paid infrastructure was authorized.
  • The earlier pnpm --dir evals lint:layers run exited 54, reporting 54 violations outside the changed files.
  • Earlier node evals/scripts/spec-channel-ratchet.mjs and node evals/scripts/spec-boundary-ratchet.mjs runs exited 1, reporting violations outside the changed files. No baselines were changed. These failures were not reproduced in a clean-base control and are not classified as pre-existing.
  • Earlier published CI evidence must not be treated as coverage of this changed journey without checking its selected tests and source commit.

UI/UX impact

None — existing visual design and controls are preserved. The fixes restore paging and navigation readiness without adding controls or interaction styling. DESIGN P5: reuse existing message primitives and scroll-anchor machinery. DESIGN P10: the real-size screenshot below shows the bounded conversation at its first message.

Real local conversation at the first message, with synthetic planning notes and unchanged chat controls

Captured at aa469e8ba, 1280×900, local app-web with 150 stored synthetic messages. Product source is identical at 4d5051eb5; that later commit strengthens tests only. This image illustrates the real UI, not full runtime-proof coverage.

Limitations

Windowing operates on whole groups, not individual nodes inside a very large message. The latest/priority groups, active focus or selection, and deliberately changed disclosure states are retention exceptions; Find temporarily mounts all groups. Retained interaction exceptions can grow with explicit interactions, so this is not a hard constant cap on total DOM nodes. No merge, release, or deployment is included.

@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 17, 2026 1:10am UTC
openwork-den Ignored Ignored Preview Sep 17, 2026 1:10am UTC
openwork-diagnostics Ignored Ignored Preview Sep 17, 2026 1:10am UTC
openwork-landing Ignored Ignored Preview Sep 17, 2026 1:10am UTC

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit 4d5051eb5aaf303c805626bc675e95555f29c480 · selected evidence

Open review report

@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 (57177 ms), confidentiality-review (115971 ms), spec-provenance-review (194572 ms), desktop-den-sync-review (144482 ms), design-spec-review (164549 ms).

Blockers

  • None.

Advisories

  • LSC-UY5 · medium · spec-provenance-review · evals/specs/session-full-history-on-open.e2e.test.ts:288
  • 28N-35J · low · design-spec-review · apps/app/src/components/chat/progressive-message-list.tsx:31

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: 0 of 2 observed
  • Observed resolved/unresolved transitions in retained snapshots: 2 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 2
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 3/20 run attempts retained; truncated: false
  • Transition snapshot: 2/2 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 (11247b26e1ae3a4464ea8a9319d8a2b906d064f9). 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 (aa469e8baedcc3a36bb76696d98ea84bbb11b884). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@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 (4d5051eb5aaf303c805626bc675e95555f29c480). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

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