Skip to content

Unbreak main: raise the startup transfer budget to the margin it shipped with - #10700

Merged
danielhanchen merged 4 commits into
mainfrom
bundle-budget-startup
Sep 10, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
bundle-budget-startup

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Why main is red

Frontend CI has failed on every push to main since dc1b0be27 (2026-09-09 11:52 UTC).
Three different causes ran back to back. The first two are already fixed (a missing
readFileSync import, then an autoload guard test). Since 92141b327 (2026-09-10 02:16 UTC)
the sole remaining failure is Frontend build + bundle sanity, step npm run bundle:check,
and that is what is red now.

What actually crossed the line

npm run bundle:check compares the eager startup transfer size against BUDGET.transferBytes,
currently 1,620,000 bytes. Building each commit locally reproduces CI to the tenth of a
kilobyte, so these are exact byte totals:

commit PR eager transfer vs 1,620,000
3f2c89537 #10622 1,612,504 B (1574.7 KB) -7,496
e3e457a7d #10629 1,617,783 B (1579.9 KB) -2,217
ab2882388 #10627 1,619,986 B (1582.0 KB) -14
1ad44677d #10471 1,619,986 B (1582.0 KB) -14
7b9bb0395 #9690 1,620,001 B (1582.0 KB) +1, first over
92141b327 #10654 1,620,164 B (1582.2 KB) +164
d4ef69f84 #10668 1,623,641 B (1585.6 KB) +3,641

main crossed the ceiling at 7b9bb0395 by one byte, with its parent sitting 14 bytes inside.
The only frontend change in 7b9bb0395 is one English sentence in
keyless-api-access-section.tsx, rewritten shorter, which happens to compress 15 bytes worse.

The gate did not report any of this at the time because the job never reached that step: from
dc1b0be27 to 1b0a2e419 a typecheck error and then a unit test failed ahead of the build.
92141b327 fixed the last of those and uncovered the budget failure that had been sitting
there since 7b9bb0395.

Which of the two fixes this is

The script offers two remedies: unwind a static import the first screen does not need, or raise
the budget with the measurement. I looked for the first one and it is not there.

Across the whole window the eager chunk set gained no member. The one commit that changed what
is eager is #10629, which restored the eager SettingsDialog and FloatingMonitor mount that
#10236 had made lazy. That was an intentional, reviewed startup UX fix, it grew an already-eager
chunk rather than adding one (nine small shared chunks were absorbed into larger eager ones, so
the chunk count fell from 91 to 82), and even with it main was still 2,217 bytes inside budget.
Its own Frontend CI runs were all cancelled, so the gate never priced it, but it did not break
the ceiling either. There is nothing to lazy-load in the commit that did.

So this is drift, and the budget is stale. Its history says the same thing: #8964 set 1,600,000
against a measured 1,496.2 KB on 2026-08-16, which is 67.9 KB of headroom (4.4%) and absorbed
17 days of ordinary work. #10054 then set 1,620,000 against a measured 1,562.6 KB, which is
19.4 KB (1.2%), about a quarter of the original margin, and it lasted six days. A ceiling that
main sits one byte under is not a gate, it is a coin flip on the next string edit.

The raise

main at d4ef69f84 measures 1,623,641 bytes (1585.6 KB) transfer, 5,306.4 KB raw,
82 chunks
. New transferBytes is 1,690,000, which leaves 64.8 KB (4.1%) spare.

That figure is not rounded to taste. It restores the proportion this file shipped with in #8964
(67.9 KB, 4.4%), which is the calibration that demonstrably worked. Measured drift since
17363f8a2 is 1,496.2 KB to 1,585.6 KB over 24 days, about 3.7 KB of transfer a day, so 64.8 KB
is roughly 17 days, the same lifetime the original margin bought. Going wider would blunt the
gate for less reason: the failure mode it exists to catch is a single static import of something
the first screen does not need, and the case documented in the file was a 2.4 MB dialog, far
above 64.8 KB compressed.

rawBytes is deliberately left at 5,500,000. main measures 5,306.4 KB raw against it, which is
64.7 KB spare, about 16 days at the measured 4.1 KB a day. Raising it now would push the two
halves onto different clocks; leaving it means the next re-measure is one PR covering both.

Verification

From studio/frontend, on this branch at d4ef69f84:

before:  eager startup JS: 5306.4 KB raw, 1585.6 KB transfer, 82 chunks
         over the startup budget: transfer 1585.6 KB > 1582.0 KB      (exit 1)

after:   eager startup JS: 5306.4 KB raw, 1585.6 KB transfer, 82 chunks
         within budget (64.8 KB transfer, 64.7 KB raw to spare)       (exit 0)

The build is byte-identical either side. Only the ceiling moved.

  • npm test: 7275 pass, 0 fail, 0 cancelled, 0 skipped, 0 todo.
  • npm run typecheck: clean, exit 0.

The comment above BUDGET records the measurement, the commit that crossed, and why this
headroom rather than more or less.

Frontend CI has been red on main since 7b9bb03, which crossed the
1,620,000 byte startup transfer ceiling by one byte. Its only frontend
change is one English sentence in a settings panel, rewritten shorter.

Nothing became eager that should not be: across the window the eager
chunk set gained no member. main now measures 1,623,641 bytes, so raise
the ceiling to 1,690,000, which is 64.8 KB (4.1%) of headroom, the same
margin this file shipped with in #8964. rawBytes is left alone at 64.7 KB
spare so both halves come up for one re-measure together.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-10T06:23:37.374127Z 8c5c49f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Main raised the same ceiling to 1,645,000 independently. Keeping 1,690,000: main
measures 1,585.6 KB and clears 1,645,000 by 20.9 KB, which is 1.3% and about six
days at the measured drift -- the same margin the previous raise left, which
lasted six days.
@danielhanchen

Copy link
Copy Markdown
Member Author

Rebased on main, which raised this same ceiling to 1,645,000 in the meantime. Keeping 1,690,000, because 1,645,000 is the same squeeze again.

main measures 1,585.6 KB transfer and clears 1,645,000 by 20.9 KB. That is 1.3%, about six days at the 3.7 KB/day this file has drifted since 17363f8. It is the same margin the previous raise left, and that one lasted six days before main went red on a commit whose only frontend change was one English sentence rewritten shorter.

1,690,000 leaves 64.8 KB, 4.1%, which is the proportion #8964 shipped with and which absorbed 17 days. rawBytes stays at 64.7 KB spare so both halves come up for one re-measure together rather than each dragging main red separately.

Measured on this branch: 5306.4 KB raw, 1585.6 KB transfer, 82 chunks, within budget with 64.8 KB transfer and 64.7 KB raw to spare. The build is byte-identical to main; only the ceiling moved.

@danielhanchen
danielhanchen merged commit 0d9952f into main Sep 10, 2026
34 of 35 checks passed
@danielhanchen
danielhanchen deleted the bundle-budget-startup branch September 10, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant