Skip to content

perf(web): format minimap previews only when opened - #11181

Merged
juliusmarminge merged 3 commits into
mainfrom
legend-perf/timeline-updates
Sep 11, 2026
Merged

perf(web): format minimap previews only when opened#11181
juliusmarminge merged 3 commits into
mainfrom
legend-perf/timeline-updates

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 11, 2026

Copy link
Copy Markdown
Member

Streaming 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: final-turn minimap preview After: same preview and viewport

Before navigation and streaming:

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/56590efe867cdef9/before-demo.webm

After navigation and streaming:

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/789dea2b5f537b59/after-demo.webm

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB +2 B (+0.0%) 15.1 KiB
Codex Thread snapshot wire 7.1 KiB 7.1 KiB +1 B (+0.0%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB +1 B (+0.0%) 7.8 KiB
Codex Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB
Codex Live turn messages 8 8 0 (0.0%) 21
Claude Total thread wire 13.6 KiB 13.6 KiB +7 B (+0.1%) 15.1 KiB
Claude Thread snapshot wire 7.1 KiB 7.1 KiB +3 B (+0.0%) 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 6.5 KiB +4 B (+0.1%) 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 57.8 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 9 9 0 (0.0%) 21

Baseline: 57aee3e · PR result: 3b9cf6e · Source CI: success

Scenario 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.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@juliusmarminge juliusmarminge changed the title legend perf/timeline updates perf(web): format minimap previews only when opened Sep 11, 2026
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 11, 2026 03:47
@macroscopeapp

macroscopeapp Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 8c1b016

Macroscope'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 3b9cf6e. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge added this pull request to stack #11194 September 11, 2026 04:45
@juliusmarminge
juliusmarminge force-pushed the legend-perf/timeline-updates branch from 8c1b016 to 3b9cf6e Compare September 11, 2026 05:43
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

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 57aee3e and 3b9cf6e.

📒 Files selected for processing (3)
  • apps/web/src/components/chat/MessagesTimeline.tsx
  • apps/web/src/components/chat/timelineMinimapItems.test.ts
  • apps/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.ts
Adds 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.tsx
Uses 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 null
Loading

Merge Risk: ⚪ Minimal · up to 3b9cf

The 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
juliusmarminge merged commit 8fc2536 into main Sep 11, 2026
24 checks passed
@juliusmarminge
juliusmarminge deleted the legend-perf/timeline-updates branch September 11, 2026 06:50
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 11, 2026
## What's Changed
* fix(pr): update labels and reviewers without redundant reloads by @maria-rcks in pingdotgg/t3code#11117
* fix(chat): fold question answers into tool activity by @maria-rcks in pingdotgg/t3code#11014
* fix(usage): flag unpriced model activity instead of showing $0.00 by @maria-rcks in pingdotgg/t3code#11021
* fix(server): let Claude launch args override the derived permission mode by @maria-rcks in pingdotgg/t3code#11026
* fix(editors): accept root paths and Windows servers in Zed remote links by @maria-rcks in pingdotgg/t3code#11044
* fix(web): center pull request unavailable states by @maria-rcks in pingdotgg/t3code#11110
* fix(web): remove sidebar pull request link icon by @maria-rcks in pingdotgg/t3code#11179
* fix(ui): color linked pr counts by aggregate status by @maria-rcks in pingdotgg/t3code#11180
* fix(preview): render website favicons for browser tool activity by @maria-rcks in pingdotgg/t3code#11032
* fix(web): simplify pull request summary sections by @maria-rcks in pingdotgg/t3code#10612
* fix(web): preserve drafts when compacting context by @maria-rcks in pingdotgg/t3code#11103
* fix(server): queue messages during context compaction by @maria-rcks in pingdotgg/t3code#11107
* perf(web): format minimap previews only when opened by @juliusmarminge in pingdotgg/t3code#11181
* perf(web): reuse completed Markdown prefixes while streaming by @juliusmarminge in pingdotgg/t3code#11193
* perf(web): resume syntax highlighting from completed lines by @juliusmarminge in pingdotgg/t3code#11196
* perf(web): preserve completed code-line DOM while streaming by @juliusmarminge in pingdotgg/t3code#11198
* perf(web): huge-thread switch no longer blanks the chat pane by @juliusmarminge in pingdotgg/t3code#11169


**Full Changelog**: pingdotgg/t3code@v0.0.41-nightly.20260911.1520...v0.0.41-nightly.20260911.1533

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.41-nightly.20260911.1533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant