perf(web): format minimap previews only when opened #11181
main fromrefs/pull/11181/head·merged by juliusmarminge View on GitHubStreaming updates eagerly compacted every loaded prompt and response for the timeline minimap, including when its preview was closed. Keep the source text in the minimap index and compact only the selected preview. Message targets and preview content stay the same.
| Production client replay | Before | After |
|---|---|---|
| Median update | 23.0 ms | 20.9 ms (−9.1%) |
| Median run p95 | 36.9 ms | 32.4 ms (−12.2%) |
Five rotated-order runs, 120 measured updates per run, 12 stable TypeScript fences and a growing prose tail. Same browser, origin, viewport and synthetic data; no concurrent builds or local checks. The measurements compare ab67795 with this PR's unchanged runtime implementation. Later commits adjust test fixtures only. CI validates integration with newer main. These are client rendering measurements, not provider/network throughput or production user percentiles.
A separate 200-response × 20KB stage benchmark reduced minimap item construction from 21.25 ms to below 0.1 ms. This is an isolated stage saving, not a whole-app multiplier. An open preview still formats its selected response in full.
Exploration and rejected experiments · Production samples · Minimap stage samples · Benchmark source and reproduction notes
Impacts the web timeline and the web renderer used by desktop. Mobile, server, providers, wire contracts and file/diff implementations are unchanged. No new dependency, truncation, observer or state-library migration. Conditional HTML parsing, toolbar measurement observers, and code-block memoization were discarded after compatibility or timing checks; this PR contains only lazy preview formatting. Further measured improvements are separate layers in #11193, #11196 and #11198.
Validation: 103 focused timeline tests, web typecheck, targeted lint with pre-existing timeline warnings, and current-head CI. Browser checks cover minimap keyboard navigation, long-history navigation, selected text/DOM identity through 30 streaming updates, Markdown disclosures, a 10,000-line file to EOF, and split/collapsed working-tree diffs. No new flicker was observed in these checks. Native mobile and Electron shell behavior were not exercised.
| Before | After |
|---|---|
![]() | ![]() |
Before navigation and streaming:
After navigation and streaming:
Recordings show visual states and compress dropped-frame intervals; timing comes from separate unrecorded runs. 0.8 seconds of recorder-induced startup was trimmed. No private transcript or authentication data is included. The source tree contains no probe or evidence files.
Model: GPT-6. Harness: Codex.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge changed the title
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
8c1b016Macroscope's review found this PR approvable — This localized web optimization defers minimap text formatting until a preview is opened while preserving navigation targets and displayed content. The supporting tests cover the extracted logic, and no schema, deployment, security, billing, default, or static-analysis behavior is changed.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).3b9cf6e. Prior analysis still applies.No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Team
Run ID:
fafd6ea9-0c3c-4609-b968-935203ec5dd1📥 Commits
Reviewing files that changed from the base of the PR and between 57aee3e19f1910f3323f06384bb2a1d02b79e369 and 3b9cf6eec966edd86aee57fdd74e46923e4c68b4.
📒 Files selected for processing (3)
apps/web/src/components/chat/MessagesTimeline.tsxapps/web/src/components/chat/timelineMinimapItems.test.tsapps/web/src/components/chat/timelineMinimapItems.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Changes#
Timeline minimap
Layer / File(s) Summary Minimap item derivation and preview resolution
apps/web/src/components/chat/timelineMinimapItems.ts,apps/web/src/components/chat/timelineMinimapItems.test.tsAdds shared minimap item types and helpers. User turns retain their source text and receive the final assistant response before the next user turn. Tests cover grouping, normalization, null previews, jump targets, and streaming text. MessagesTimeline integration
apps/web/src/components/chat/MessagesTimeline.tsxUses the shared derivation and preview resolver. Removes local minimap helpers and memoizes the active preview. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Sequence Diagram(s)#
sequenceDiagram participant MessagesTimeline participant deriveTimelineMinimapItems participant resolveTimelineMinimapPreview MessagesTimeline->>deriveTimelineMinimapItems: pass timeline rows deriveTimelineMinimapItems-->>MessagesTimeline: return minimap items MessagesTimeline->>resolveTimelineMinimapPreview: resolve active item resolveTimelineMinimapPreview-->>MessagesTimeline: return normalized preview or nullMerge Risk: ⚪ Minimal · up to
3b9cfThe minimap change preserves source text for indexing while resolving formatting only for the active preview, with no identified merge-blocking behavior regression.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: minimap previews are formatted only when opened. Description check ✅ Passed The description explains what changed, why it changed, scope, performance results, UI evidence, validation, and limitations. It does not use the template headings or include the checklist explicitly, … - Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch `legend-perf/timeline-updates`
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge merged this8fc2536
juliusmarminge closed this
Sign in to join this conversation.


Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
57aee3e· PR result:3b9cf6e· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.