Skip to content

Add --verify-concurrency to cap verifications in flight - #21

Open
gfortaine wants to merge 1 commit into
rails:mainfrom
gfortaine:feat/verifier-concurrency
Open

gfortaine wants to merge 1 commit into
rails:mainfrom
gfortaine:feat/verifier-concurrency

Conversation

@gfortaine

Copy link
Copy Markdown

On a single Docker host, lemans run -c N lets every trial verify at the same time. The heavy multistep
verifiers run whole Rails/RSpec suites, often twice (baseline and candidate), inside the bench's
2-CPU / 2 GB sandboxes. When several overlap they slow each other past the task's verifier timeout, and the trial
ends as verifier_error (exit 124). The model's work is lost to the host, not to the model.

What we saw running the full 46-task bench locally (Docker, arm64 images, 6 trials in flight):

  • ms-redmine-rails-upgrade: 5–10 min to verify when alone; 20 min and timed out (exit 124) when it overlapped
    other suites. That was 7 of 16 verifications.
  • ms-mastodon-tests: the baseline models suite took 29 min under contention and wasn't even green
    (4 failures).
  • ms-forem-active-storage, ms-retire-proposals, ft-kamal-deploy: same verifier exited 124.

This adds a run-level knob:

lemans run -c 6 --verify-concurrency 1
lemans restart RUN --reverify --verify-concurrency 1
  • Runner builds one Concurrent::Semaphore for the run when the option is set, and passes it to each
    Runner::Task and Trial.
  • Trial holds a slot only around Verifier#verify!. Agent phases stay fully parallel.
  • The verifier's own timeout starts inside the slot, so waiting is never charged to the tests.
  • Default is unchanged: no option means no limit, so Daytona runs behave exactly as before.
  • Trial.new(task).run still works standalone: verification_slots: is optional.

Tests: ConfigTest#test_load_options covers the option. A new
TrialTest#test_a_verification_waits_for_a_free_slot_and_gives_it_back checks that a held slot blocks the
verification and is released afterwards. bundle exec rake test passes (346 runs, 0 failures) and
bundle exec rubocop is clean.

Pairs well with the existing lemans restart --reverify, which re-grades a trial that already timed out without
calling the model again.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant