perf(agent-pane): defer mock fixtures and preload startup module

Merged
TE
12d ago
+212-28

Native chats eagerly loaded the mock daemon and synthetic debug transcripts. Load those modules only when a mock page or an existing async debug command needs them, reducing eager JavaScript by 76,592 bytes (1.59%). Preload the module before locale scripts and styles; evaluation still follows localization.

Leo: “things should be instant and not shift layouts AND not take many resources”. This reduces bytes on the open-to-page-painted path. It does not establish a startup timing improvement or meet the under-300 ms goal by itself.

Mock gallery/dev entries prepare the daemon before mounting, preserving the ready handshake's synchronous ordering. Native connection ordering stays unchanged. The localization scanner classifies the extracted debug-fixture barrel alongside the existing debug helpers. No timers, observers, loops, warm browser, or persistent idle activity are added. No new idle memory is reserved; runtime RSS was not measured for this bundle change.

Validation at final head e0ea71b8eaa2f7faacdee2419bb9309cc06350f0:

Performance against base 2a48ef76ce442a85d2c83af440b49d13726a87d3:

MetricBeforeAfterDeltaRun link
Eager JavaScript bytes, entry plus static imports4,821,6044,745,012−76,592 (−1.59%)Fleet 41643000975
Big chat page-painted, native observations663.1 ms1182.5 msNot comparable: different workers/loadPrivate report
Bloated chat page-painted, native observations700.6 ms1095.8 msNot comparable: different workers/loadPrivate report

Both native arms used scripts/measure/chat-open.sh --conditions=idle --cases=big,bloated --runs=3 --turns=10000; six opens completed per arm without timeout or flash. The after arm is intermediate head 23980936ffe3ecb3897670a2584d58462823812c, not the final head. Most timing difference occurred before navigation. These observations support no causal speedup or regression claim; the demonstrated improvement is fewer eager bytes.

Final red attribution:

  • Tier routing: PullRequestTiers.test_every_routed_input_triggers_the_workflow fails on the same four skills/cmux-customization paths in the completed exact-base job at 4575ff48a5502d89384180a933114a5a3eea4e90. Test, workflow, router and input blobs match the PR merge.
  • Focused gallery comparison 41655759891 hash-verifies the complete base 4575ff48 and merge 0a34ea94 trees. All 177 emitted CSS files are byte-identical (2,441,026 bytes). Five light/dark passes per arm reproduce both exact failures on base: new-tab#suggestions-chat-url, shift 0.0473 against 0.03673 while typing; and composer-context#started-browse-error, 5,000 ms alert timeout. Both also pass in other runs. These scenes execute unchanged preview/component branches, not the changed mock/debug branches.

Nonblocking follow-ups: #33792 (broader lazy-module sentinels), #33793 (isolate preload benefit), #33794 (mock-load diagnostic).

Agent session: agent session