Skip to content

Defer Markdown far from the view so long threads open fast - #463

Merged
BunsDev merged 2 commits into
mainfrom
hosted-budget
Oct 31, 2026
Merged

BunsDev merged 2 commits into
mainfrom
hosted-budget

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Val chose "Defer offscreen answers" on 2026-10-30 after the hosted cold-open analysis. This PR is for Val's review before it is queued.

Why. The approved 500 ms five-launch cold-open gate (e2e/transcript-measure.spec.ts) failed on hosted runner variance. Across 33 hosted runs on 2026-10-30 the median was 377.7 ms. Run 41056164788 failed at 781.9 ms on application code identical to a 436.1 ms pass two minutes earlier. Traces show a cold open is one renderer task of 150–180 ms (locally), about 110 ms of it parsing Markdown for every visible answer.

Change.

  • DeferMarkdown (Markdown.tsx) wraps every turn before the newest eight (ThreadView.tsx). Its Markdown shows as written (escaped text, .md-deferred) until it comes within 1,500 px of the transcript's view, then parses once and stays parsed.
  • Text already parsed this session renders at once.
  • The newest turns and any streaming turn are unchanged.
  • Chromium's scroll anchoring keeps the reader's place while answers above it parse.

The gate is unchanged. The budget probe now also requires the last answer to be parsed Markdown, so a deferred answer can't count as opened.

Results (local, M5 Max).

  • Five-launch median: about 190 ms before, 88 ms after.
  • With the first open throttled to 3× CPU: medians 806–870 ms before, 312–340 ms after.
  • First-pass full suite:
    • build and unit tests passed;
    • E2E 477 passed, 7 skipped, 1 failed;
    • the failure was the Companion clipboard case companion.spec.ts:44, which is unrelated and passed when rerun alone.

Tests.

  • New e2e/markdown-defer.spec.ts:
    • the newest answer parses at once, and the oldest parses on scroll and stays parsed;
    • a middle answer doesn't move while the answers above it parse. Negative control: with overflow-anchor: none this case fails, moving 96 px.
  • New unit cases in test/markdown-render.test.ts.

For review.

  • Until an answer nears the view, assistive technology would read it as Markdown source. VoiceOver moves the view as it navigates; no person has tested this, and C1–C5 remain deferred.
  • Copying a deferred answer copies its Markdown source.

Evidence: docs/reviews/2026-10-30-deferred-markdown.md; status.md updated.

🤖 Generated with Claude Code

Hosted CI's approved 500 ms cold-open gate failed on runner variance:
a cold open spent ~110 ms parsing Markdown for every visible answer.
Turns before the newest eight now show their text as written until it
nears the transcript's view, then parse once and stay parsed; scroll
anchoring keeps the reader's place. The budget probe waits for parsed
Markdown. Local five-launch median ~190 -> 88 ms; 3x throttled
806-870 -> 312-340 ms. The gate is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 31, 2026 3:59am UTC

Request Review

@github-code-quality

github-code-quality Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 21f6a70 hosted-budget ac107ab +/-
66% 66% 0%
View coverage of the 2 most impacted files.
File main 21f6a70 hosted-budget ac107ab +/-
apps/desktop/sr...ts/Markdown.tsx 89% 87% -2%
apps/desktop/sr...gine/plugins.ts 97% 97% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 31, 2026 05:06 UTC

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — ac107abe Deployed Oct 31, 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.

2 participants