Skip to content

perf(chat): reuse settled groups during history backfill - #4845

Merged
reachjalil merged 1 commit into
devfrom
perf/long-thread-rendering
Sep 10, 2026
Merged

reachjalil merged 1 commit into
devfrom
perf/long-thread-rendering

Conversation

@reachjalil

Copy link
Copy Markdown
Member

Summary

Follow-up to #4838: progressive history loading should not repeatedly invoke settled group renderers, and ordinary composer edits should not create a new displayed transcript.

  • Reuse settled group callback output during internal backfill batches.
  • Invalidate reuse when group references, indexes, or parent render callbacks change; preserve context updates and stateful tool details.
  • Compute group keys and anchor lookup outside internal mount updates.
  • Keep displayed transcript-array identity stable across ordinary draft, attachment, and paste edits. Autosend previews still update, while captured sends remain independent of the next draft.

Existing scroll lifecycles, scheduling, full-history availability, owner checks, and background task behavior remain unchanged.

Quantitative check

Actual component render callbacks during complete backfill, with fixed synthetic geometry:

Groups Before (#4838 review) This candidate
80 440 80
800 40,400 800
1,600 160,800 1,600

Initial callbacks remain eight. These measure callback work, not full child renders, frame time, or wall-time speedups. Plan construction and reconciliation still revisit mounted history; this does not claim to eliminate all quadratic work or bound eventual DOM memory.

Verification

Candidate: 046c4ab98aeb2738ffbcb9df018491af14664005, based on dev at fb3bc5b219ec3904baeeefc9738930b2bcb7d096. Commit signature verified.

Passed from apps/app:

pnpm exec bun test --isolate ./tests/progressive-message-list.test.tsx ./tests/use-displayed-messages.test.tsx ./tests/message-list-loading.test.tsx ./tests/chat-message-grouping.test.ts
pnpm run typecheck
  • 54 passed, 0 failed, 0 skipped, 287 assertions; exit 0.
  • App typecheck and git diff --check: exit 0.
  • Tests assert callback counts at 80/800/1,600 groups, callback-capture invalidation, live updates, index shifts, context propagation, Find, actual message-list completion transitions, retained tool expansion state, and the production displayed-message hook.

Proof verdict: Incomplete

Exact-head real-app evidence remains outstanding. Existing journey owners:

pnpm evals:e2e session-full-history-on-open
pnpm evals:e2e streamed-markdown-answer

No measured typing latency, native-scroll, sustained-memory, or end-to-end speedup claim is made. Large histories and concurrent streaming still need comparable base/candidate measurements.

Scope

Independent PR targeting dev. Partial-history correctness and reading/Find continuity are separate follow-ups.

Deliberately deferred: input-aware scheduling, giant-turn inner chunking/aggregate construction, render eviction, background cache budgets, multiple-visible-session scheduling, offscreen app resource gating, and a new history API. These are separate architecture/performance decisions, not prerequisites for the bounded callback and composer-identity improvements. Required repository CI is unchanged.

@vercel

vercel Bot commented Sep 10, 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 10, 2026 8:39pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 10, 2026 8:39pm UTC
openwork-diagnostics Skipped Skipped Sep 10, 2026 8:39pm UTC
openwork-landing Skipped Skipped v0 Sep 10, 2026 8:39pm UTC

@vercel
vercel Bot temporarily deployed to Preview – openwork-den September 10, 2026 20:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics September 10, 2026 20:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing September 10, 2026 20:38 Inactive
@github-actions

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. 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 (43308 ms), confidentiality-review (37307 ms), desktop-den-sync-review (62176 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Commit 046c4ab98aeb2738ffbcb9df018491af14664005 · selected evidence

Open review report

This branch was successfully deployed

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