Skip to content

test(roadmap): run the limit and monitor tests with small limits - #4931

Merged
dan-petty merged 3 commits into
mainfrom
test/4688-small-limits
Nov 12, 2026
Merged

dan-petty merged 3 commits into
mainfrom
test/4688-small-limits

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The tests of the run limits drove the limits of the jobs through a scripted model: 500 requests and 1,500 tool calls for an implement step, and 200 tool calls for a toolbox run of the stage job. Each test made hundreds of model requests, and each request ran real git. Nine tests of the implement world also waited out the watch of the checks: 121 polls of the pull request.

run_step, run_fix_step and ToolboxClient take usage_limits, a pydantic-ai UsageLimits. The default is the constants, so the jobs run at the same limits. The tests that reach a limit pass small limits and keep their relative asserts, and one test proves that the defaults equal the constants. The implement world sets roadmap.implement.monitor_timeout_seconds to three poll intervals (WATCH_SECONDS), so a watch that times out polls 4 times.

Closes #4688

Change: openspec/changes/archive/2026-11-12-4688-run-the-limit-and-monitor-tests/

@dan-petty dan-petty added type/test Type test: a new or changed test scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Before and after measurements

Both sides ran in the devcontainer with --no-cov -n 3. The base is origin/main at 3b3fddc in a separate worktree. Other agents ran tests on the same host, and the load average was 38 to 58 on 16 cores. The base run and the branch run of each set ran at about the same time, so they had about the same load. The load makes all absolute times high, so compare the ratios. A small pytest plugin recorded the CPU seconds of each test call (os.times() of the pytest process and of the git processes that it waited for), and a second one counted the reads of the pull request in PullFake.

The 13 limit tests (14 cases)

Measure Base Branch
Summed test time (wall) 1,827 s 94 s
Summed CPU time 644.9 s 28.9 s
Largest CPU time of one test 73.0 s 3.6 s
Model requests of one test up to 500 12 at most

The audit of 2026-11-11 measured 5.3 to 11.6 s for each of the 12 slowest of these tests on a quieter host, with no coverage. The CPU ratio (0.045) gives about 0.2 to 0.5 s for each test there. This is an estimate, not a measurement on a quiet host.

The 9 implement-world tests that waited out the watch

Measure Base Branch
Reads of the pull request in each test 121 to 122 4 to 5
Summed test time (wall) 1,234 s 598 s

The remaining time of these tests comes from the job itself (real git and the gate), and not from the watch.

The covering files

The 8 changed or affected test files (318 tests) pass on the branch: tests/roadmap/implement/test_roadmap_implement_step.py, test_roadmap_implement_step_repair.py, test_roadmap_implement_phase_marks.py, test_roadmap_implement_typed_result.py, test_roadmap_implement_pull.py, tests/roadmap/stage/test_roadmap_stage_toolbox.py, tests/roadmap/test_roadmap_limit_classes.py and tests/core/test_roadmap_implement_checks.py. mypy --strict passes on the two changed source files.

No fail-to-pass run: the title is test(roadmap), and the check runs only for a fix. The new test of the defaults fails on the base, because the three signatures have no usage_limits there.

Owner steps: none.

run_step, run_fix_step and ToolboxClient take usage_limits, a pydantic-ai
UsageLimits, with the loop guards of the jobs as the default. The tests that
reach a limit pass small limits, and the implement world waits three poll
intervals for the checks, so a watch that times out polls 4 times, not 121.

Refs #4688
@dan-petty
dan-petty force-pushed the test/4688-small-limits branch from 2082064 to 0a02923 Compare November 12, 2026 05:32
@dan-petty

Copy link
Copy Markdown
Owner Author

CI measurement (Tests & Coverage, with coverage)

Each shard prints its 10 slowest tests.

  • Base: the push run of main at a5288d1 (run 43158347778). 23 of the changed tests were in the 10 slowest of their shards: 3.9 to 8.6 s each, 120.6 s together. Examples: test_the_tool_calls_before_a_send_again_count_against_the_tool_call_limit 8.56 s, test_the_extra_turn_counts_against_the_request_limit_of_the_first_turn 7.47 s, the 7 phase_marks watch tests 4.0 to 4.3 s each, the 7 toolbox budget tests 3.9 to 4.9 s each.
  • Branch: the first run of this pull request (run 43157999501). None of the changed tests is in the 10 slowest of its shard. The tenth slowest test of each shard took 2.2 to 3.5 s, so each changed test took less than that.

The first run failed on one test, tests/roadmap/test_roadmap_mcp.py::test_implement_attempt_builds_mcp_toolset_from_settings, which calls the private _attempt with no usage_limits. The new push gives it UsageLimits().

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 05:40
@dan-petty
dan-petty merged commit c0401e0 into main Nov 12, 2026
23 checks passed
@dan-petty
dan-petty deleted the test/4688-small-limits branch November 12, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/test Type test: a new or changed test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(roadmap): run the limit and monitor tests with small limits

1 participant