perf(web-shell): lazy-load chat & activity feeds to fix DM-view lag#41
Merged
Conversation
Entering a DM mounted the entire transcript plus the fully-expanded
activity timeline, and the activity pipeline (clip → filter →
buildThread) was recomputed from scratch on every arriving WS row —
quadratic in turn count because hashMessage re-serialized each
exchange's full prefix.
- Add useWindowedList: render only a trailing window of each feed,
grown a page at a time, reset on context switch.
- Add thread-history: per-thread lazy history paging (hydrateThread +
loadOlderThreadMessages). Closes a gap where DM views only showed
whatever the global backfill happened to include.
- messages.ts: appendMessages fast-path concat (no full re-sort) for
in-order arrivals; add prependMessages for paging.
- AgentTimeline: memoize the clip/filter/buildThread pipeline and
objectivesSeen; WeakMap-cache hashMessage so each payload is
serialized once per page; window TimelineBody.
- Transcript: windowed render + scroll-anchored "load older" bar;
hydrate the thread's first page on open.
First paint is now bounded (~80 message rows / ~60 thread items) and
the per-WS-frame cost drops from a full quadratic pipeline to a memo
hit plus a window slice.
Signed-off-by: Andrew Jon Przybilla <andrew@przy.email>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Entering a DM mounted the entire transcript plus the fully-expanded
activity timeline, and the activity pipeline (clip → filter →
buildThread) was recomputed from scratch on every arriving WS row —
quadratic in turn count because hashMessage re-serialized each
exchange's full prefix.
First paint is now bounded (~80 message rows / ~60 thread items) and
the per-WS-frame cost drops from a full quadratic pipeline to a memo
hit plus a window slice.
Related
Checklist
git commit -s) — the DCO bot will confirmpnpm lintis cleanpnpm typecheckis cleanpnpm testpasses