Repository navigation
fix(tests): compare the Codex bounded-time cases with an input of the same size - #2169
Conversation
… same size The CPU-time growth from a small input to a five times larger one, which #2150 bounded, still moved on busy hosts: the unclosed-links case (3x as written, bound 8) read 10.8 on a GitHub runner, and under local load the large-answer and citation cases crossed their bounds too (10.3 vs 10, 45.5 vs 40). Each case now times its input against one as large that the code reads in one pass, so the work both share stays out of the ratio, and a quadratic scan still costs a multiple that grows with the size. The matcher cases also get a 30 s timeout, for direct runs without --timeout on a busy host (#2155).
Codex's review: without a thread clock (Windows), process.cpuUsage counts in steps of about 16 ms, and only the first reference run was checked against the 20 ms floor. A later, warmer run could read none, so the ratio read NaN or Infinity (5 of 30 runs on a modeled coarse clock, and the parent commit fails the same way). The least reference of each set of three is now checked, and the set is timed again over twice the runs while it is short; on that clock the floor is 100 ms, several steps. The large-answer case reads 8 candidates instead of 32: the ratio does not depend on how many, and six runs sharing two cores took up to 11.6 s with 32. The citation case gets the 30 s timeout too, which it needed on the modeled coarse clock under that load.
Under load the regex-split regression read as low as 85 against the bound of 10 with answers of 4,000 characters. Its multiple grows with the length while the as-written one does not: with 8,000 it read 403 to 506 (10 runs) and the code as written 1.18 to 1.76 (30 runs, at most 505 ms each), all at once on one host.
Across 450 loaded runs the citation case read 0.6 to 5.7 as written, the top one outlying (the rest under 3.5); its regression reads about 670. A bound of 20, as the large-answer case has, keeps a 33 times margin to the regression and more room for a busy runner.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
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. Comment |
|
The |
|
Merging baf772e: omo-native-code-reviewer and Codex both pass this head. It fixes the CPU-ratio flake from #2150 that failed Fast checks on #2158 (10.8, 8.3) and #2161 (9.1). It is test-only, every quadratic mutation still fails its case by a wide margin, and 26 direct runs under heavy load passed, with and without |
Follow-up to #2150. Addresses item 1 of #2155; the other #2155 items are left as they are.
Change
Test-only:
server/codex.test.ts, plus the wording of #2150's unreleased changelog fragment.#2150's bounded-time cases compared the thread CPU time of a small input with that of an input five times larger. That growth still moved on busy hosts:
dori heavy, six copies at a time alongsidebun run check fast), the other two cases crossed their bounds as well: large answer 10.33 vs 10, citation 45.5 vs 40.Each case now compares its input with one of the same size that the code reads in one pass. The work both share (parsing, the screen) stays out of the ratio, while the regression's cost grows with the size:
](cutAtLinkTargetsas a regex splitcutAtLinkTargetswithunshift(work per link grows)'instead of backticksThe "as written" ranges cover every loaded run below.
The helper (
cpuGrowth, nowcpuRatio) also takes a fix for a problem Codex reproduced, which predates this PR. Without a thread clock (Windows),process.cpuUsagecounts in steps of about 16 ms, and only the first reference run was checked against the 20 ms floor. A later, warmer run could read 0, which made the ratio NaN or Infinity. The least reference of each set of three is now checked, and the set is timed again over twice the runs while it is too short. On that clock the floor is 100 ms.#2155 item 1: the three cases get a 30 s timeout, so direct runs without
--timeoutdo not hit Bun's 5 s default on a busy host. The large-answer case also reads 8 candidates instead of 32: the ratio does not depend on the count, and with 32, six runs sharing two cores took up to 11.6 s.Known limit: a reference of the same size bounds the cost tied to what the regression reacts to (unclosed links, links, backtick runs). It does not catch a cost that grows with the text's length alone, which both inputs share. The doc comment says so.
Proof
SHAs below are from before the rebase onto bcd75e0, with no conflicts: f49d460e = ec224ec, 7f3515df = 057d4ed, 83412911 = a6780c6, ff480649 = baf772e.
bun run check fastpassed on the rebased head as well.All runs use this host's thread clock unless noted. Logs are in the lane's
.omo/run.dori heavy, alongsidebun run check fast. Each round ran the real file without--timeoutplus five ratio-logging copies at once.taskset): 30 rounds and 0 failures (unclosed max 1.68, large max 8.03, citation max 3.46).unshift: 145 to 247 against 20.process.cpuUsageis floored to 15.625 ms per user/system counter, which is Codex's model.bun run check fast: ok on ff480649 (7,904 pass, 0 fail).Reviews
matchShortCodexAnswers's second loop) was already true before this PR.