Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/11181/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

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 replayBeforeAfter
Median update23.0 ms20.9 ms (−9.1%)
Median run p9536.9 ms32.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.

BeforeAfter
Before: final-turn minimap previewAfter: 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.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.5 KiB13.5 KiB+2 B (+0.0%)15.1 KiB✅
      CodexThread snapshot wire7.1 KiB7.1 KiB+1 B (+0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.5 KiB+1 B (+0.0%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.0 KiB57.0 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages880 (0.0%)21✅
      ClaudeTotal thread wire13.6 KiB13.6 KiB+7 B (+0.1%)15.1 KiB✅
      ClaudeThread snapshot wire7.1 KiB7.1 KiB+3 B (+0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.5 KiB6.5 KiB+4 B (+0.1%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.8 KiB57.8 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages990 (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.

    3. juliusmarminge changed the title

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 57aee3e19f1910f3323f06384bb2a1d02b79e369 and 3b9cf6eec966edd86aee57fdd74e46923e4c68b4.

      📒 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

      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 nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Title check✅ PassedThe title clearly and concisely describes the main change: minimap previews are formatted only when opened.
      Description check✅ PassedThe 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.
    6. juliusmarminge merged this8fc2536

    7. juliusmarminge closed this

Sign in to join this conversation.