Skip to content

Keep shiki and the empty state off the markdown page's first load - #22127

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
fix-markdown-eager-js-budget
Oct 19, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
fix-markdown-eager-js-budget

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the base red in scripts/check-webviews-diff-budget.mjs: the markdown page's eager JS was over its 1,400,000-byte budget at 1,407,890 bytes, so ci-web skipped every step after the budget check, including the webview and browser tests. The budget stays the same.

Byte counts (node scripts/check-webviews-diff-budget.mjs, local build)

surface before (base 86efbba) after budget
markdown page 1,407,890 1,118,864 1,400,000
diff surface 1,490,877 1,424,935 1,500,000
diff page 1,481,734 1,415,792 1,500,000
diff worker 253,369 253,406 400,000
editor page 450,735 450,790 500,000

The markdown page drops 289,026 bytes. shiki-core.mjs (222,504) and pickerModel.mjs (93,379) are gone from its eager set. The new chunks pageShared.mjs (27,403) and text-utils.mjs (463) are added. The diff pages also stop loading pickerModel eagerly, since cx was the only thing they needed from it.

What changed

  • shiki-core. The markdown page already loaded Shiki with import(). It was eager only because ccount and zwitch, which both shiki's hast serializer and the markdown serializer use, had been pulled into shiki-core. They now have their own text-utils chunk (463 B). The page starts fetching Shiki's core and its JS regex engine at boot, without waiting on them, so they are ready before a code block asks for colors.
  • pickerModel. The shared viewer chunk is split in two. pageShared holds appearance, the page client, i18n, ops and cx, and stays eager. pickerModel holds the empty states, the picker model and their ~60 KB string table. The markdown page imports its empty state with React.lazy. The import starts at boot, alongside the host's config round trip that decides between a file and the empty state, so the chunk is in hand before the empty phase renders. Suspense covers the rare case where it is not.
  • ci-web (react-apps-check-shard). The budget step now uses continue-on-error. A new final step, Fail on the eager JS budget (if: !cancelled() && steps.eager-js-budget.outcome == 'failure'), fails the job when the budget fails. A budget miss no longer skips React Compiler, bun run check, the engine install, the PR-scoped rules or Test webviews. A failed bundle build still stops everything after it.

First paint

Measured on the production-built latency harness page (test/latency/markdown.html, the real markdown page on the mock host), headless, median of 15 loads, two interleaved rounds:

text painted code colored CLS
chromium before 120–122 ms 179–182 ms 0.0022
chromium after 106–112 ms 167–175 ms 0.0022
webkit before 156–162 ms 901–1013 ms 0
webkit after 140–144 ms 902–918 ms 0

There is no new plain-to-colored step: highlighting was already asynchronous per grammar, and the prewarmed core keeps it as fast as before. CLS is unchanged.

Verification

  • node scripts/check-webviews-diff-budget.mjs passes. Numbers are above.
  • Lint and type check (vp lint --type-aware --type-check) are clean, and vp fmt is clean on the touched files. bun run check fails on base for reasons unrelated to this PR: check:type-scale (syncMotion.gallery.css) and the formatting of settings/icons.tsx. The same holds for subtle-elevation and ui-rules in bun test. check-webviews-react-compiler.mjs passes. test_pr_scoped_webviews_checks.py passes.
  • bun test passes: diff-worker-bundle, diff-label-bundle, path-picker-model, caret-selection, code-pages-terminal-font, render-fence. editor-csp passes with CMUX_BROWSER_TESTS=1, including Monaco staying lazy on the markdown page.
  • actionlint on ci-web.yml is clean.

🤖 Generated with Claude Code

@cursor

cursor Bot commented Oct 19, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 02fe7352-b813-4d43-9c0e-e089e570b0b4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@teamleaderleo
teamleaderleo force-pushed the fix-markdown-eager-js-budget branch from 713c63d to 06a17e2 Compare October 19, 2026 20:34
@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Moves shared text utilities out of the Shiki chunk and loads the markdown empty state through React.lazy.

  • The markdown page keeps heavy code out of its first load.
  • Web checks keep running after an eager JavaScript budget miss.

No actionable issues were found. The merge-base checks differed, so the full PR diff was reviewed as the change since the last review. No previous review threads were supplied. Builds and browser tests were not run.

Reviews (2) · Last reviewed commit: "Keep shiki and the empty state off the m..." · Reviewed by Greptile

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-nnyoq created for this PR by the cmux coordinator.

The markdown page evaluated shiki-core (~222 KB) and the viewer pages'
pickerModel chunk (~93 KB) before it drew, which put its eager JS over the
1.4 MB budget and made ci-web skip the webview tests.

- ccount and zwitch (used by both shiki's hast serializer and the markdown
  serializer) get their own tiny text-utils chunk, so shiki-core is no longer
  a static import of the markdown page. Shiki already loaded lazily; the page
  now prewarms its core at boot so code colors arrive as fast as before.
- The shared viewer chunk splits into pageShared (appearance, page client,
  i18n, ops, cx) and pickerModel (the empty states, picker model and their
  string table). The markdown page imports its empty state lazily, requested
  at boot beside the host's config round trip, behind Suspense.
- ci-web: a budget miss no longer skips the checks and tests after it; the
  job fails on it in a final step instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teamleaderleo
teamleaderleo force-pushed the fix-markdown-eager-js-budget branch from 06a17e2 to dbcf70e Compare October 19, 2026 20:46
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review dbcf70e: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr22127 -f ref=fix-markdown-eager-js-budget -f platform=macos -f backend_mode=local

Unclear: web / react-apps-check (2) failed: no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check).

CI failed on dbcf70ed3d (run 39322116549 attempt 1): 3 unknown.

Job Verdict Why
web / react-apps-check (2) unknown no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check)
web / react-apps-check (1) unknown no known signature; failed step: Check webviews (Oxlint, Oxfmt, type check)
web / react-apps-check unknown no known signature; failed step: Check webview test shards

Not re-run automatically: web / react-apps-check (2), web / react-apps-check (1), web / react-apps-check are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: web / Web status; do not merge until green; see lane-rules
red: web / react-apps-check; do not merge until green; see lane-rules
red: web / react-apps-check (1); do not merge until green; see lane-rules
red: web / react-apps-check (2); do not merge until green; see lane-rules

CI fast guards failed on dbcf70ed3d (https://github.com/manaflow-ai/cmux/actions/runs/39322116549). It does not block the merge; a red guard merged into main breaks it for every open PR.
The log named no failed step; see the run.

Agents: python3 scripts/ci/guard_attribution.py fix applies the mechanical fixes locally.

@blacksmith-sh

blacksmith-sh Bot commented Oct 19, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
NEXT post-publication dependency contract/NEXT post-publication dependency contract View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Merging at dbcf70e over base reds only (merge hub, projects-70). This PR touches only webviews/src/pages/markdown/{highlight.ts,main.tsx}, webviews/vite.config.ts and .github/workflows/ci-web.yml, and its budget step passes (1,407,890 → 1,118,864). Every red check also fails on feat-cmux-next, in files this PR doesn't touch:

  • cmux-next checks: HomeHostView NSWorkspace.open, the 133 missing translations, type-scale debt, the remote_host/config.rs literal path, the cmux-tui-tree-inputs.txt line, and the missing schemas/sync-motion/streams.json. Fixes are in leoli-63's cmux-next: clear two base reds in cmux-next checks (Home shortcut open, cmux host dir) #22101 and the base-reds lane's combined PR.
  • web / react-apps-check (all 3 shards): React Compiler CompileErrors in web agent-session/acpmux/* (App.tsx, changes/*), the same as on other fresh feat-cmux-next PRs.
  • release-notary: test_nightly_next_post_publish.py, also red on base.
  • action export areas: cancelled, not failed.

@teamleaderleo
teamleaderleo merged commit 5da31c2 into feat-cmux-next Oct 19, 2026
@teamleaderleo
teamleaderleo deleted the fix-markdown-eager-js-budget branch October 19, 2026 21:00
teamleaderleo added a commit that referenced this pull request Oct 19, 2026
…st a budget red)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teamleaderleo added a commit that referenced this pull request Oct 19, 2026
…st a budget red)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teamleaderleo added a commit that referenced this pull request Oct 19, 2026
…st a budget red)

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

Copy link
Copy Markdown
Contributor

Shipped in:

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.

1 participant