You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Served state labels each revision by scanning the whole log, so it grows with revisions × events #5886
On a page with many revisions, the served state and leaf page state grow with revisions × log events. That breaks the ceiling in root AGENTS.md, Responsiveness, that computing a reading grows no faster than the page times the logarithm of its size. The cause is revision_label and stamped_version. Each scans the whole log, and the reading calls them once per revision: files.py:296 labels every version descriptor, and served_state/page.py:74 labels every revision in the served state. One pass over the notes could label every revision.
What the bench reads. Server revisions table, state ms by page size, from the daily scheduled ci run's bench-report:
agent ms (leaf page state) follows the same curve: 210 ms at 1600 on 11-11. The runs from 11-06 to 11-08 all read about 6 ms at 1600.
Why it shows now.#5716 (4363db4) gave each activated revision an activation event. The revisions collection activates n versions, so its log went from 1 event to n, and the per-revision scans became visible. Locally, leaf-dev bench revisions --read server --sizes 256,1024,1600 reads 4.1, 5.6 and 6.5 ms on 4363db4's parent and 10.3, 109.3 and 274.7 ms on 4363db4. Real pages already paid this cost whenever they had many revisions and a long log. #5716 only made the bench page carry one. On current main (b3387f111), --profile attributes the growth to revision_label (exponent 1.74) and stamped_version with its generator (1.69–1.88).
Reproduction
uv run leaf-dev bench revisions --read server --sizes 256,1600 --rounds 1 --profile
On b3387f111 in a 4-core CI runner:
revisions state: superlinear functions
0 -> 245 ms exponent 1.74 revision_label (files.py:303)
0 -> 123 ms exponent 1.66 stamped_version (files.py:233)
0 -> 121 ms exponent 1.86 <genexpr> (files.py:236)
The commits between the last low reading and the first high one (f926f4fa7..28c3b37f3) that touch src/leaf are #5715, #5714, #5717, #5716, #5720 and #5440. The parent/child comparison above isolates #5716.
#5889 has the fix. files.revision_labels sorts the log's stamps once and labels every revision by bisecting them, replacing the scan per revision. On this runner, state ms at 1600 revisions in leaf-dev bench revisions --read server drops from 161.8 to 26.0, and --profile no longer reports a superlinear function for state or agent. The labels are unchanged, and a new model test covers them. Its CI and landing go through tend-land.
Activity
leaf-agent commentedon Nov 12, 2026
#5889 has the fix.
files.revision_labelssorts the log's stamps once and labels every revision by bisecting them, replacing the scan per revision. On this runner,state msat 1600 revisions inleaf-dev bench revisions --read serverdrops from 161.8 to 26.0, and--profileno longer reports a superlinear function forstateoragent. The labels are unchanged, and a new model test covers them. Its CI and landing go through tend-land.