Skip to content

fix(tier3): honor --n-concurrent with --stop-on-pass - #275

Merged
rng1995 merged 7 commits into
mainfrom
naren/port-stop-on-pass-concurrency
Nov 5, 2026
Merged

rng1995 merged 7 commits into
mainfrom
naren/port-stop-on-pass-concurrency

Conversation

@rng1995

@rng1995 rng1995 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • --stop-on-pass (or harbor.stop_on_pass: true) now runs up to n_concurrent eval cases at once per agent, instead of running every case and attempt one at a time.
  • Each case's attempts still run one after another, and a case stops after its first passing score. Every attempt is still its own single-trial harbor run (n_attempts=1, n_concurrent=1, --include-task-name <case>).
  • The with-skill and without-skill arms still run one after the other. Each gets the full n_concurrent budget, so per-agent concurrency matches the non-stop-on-pass path, which splits the same budget across the two arms running in parallel.
  • Attempt jobs and error messages are collected in dataset order, not completion order, so the merged <skill>-<agent>-<arm> job and the error list stay deterministic.
  • An unexpected exception in one case stops later launches: queued cases are cancelled, and running cases stop after their current attempt. The exception then propagates, and no partial aggregate is merged. This matches what the serial loop did.
  • Docs: a paragraph under "Tune the run" in docs/tier3-live-evaluation.mdx explains how --n-concurrent applies with --stop-on-pass, with a worked example. CHANGELOG entry under Unreleased / Fixed.

Why

_run_agent_pair did not pass n_concurrent to the stop-on-pass path. That path looped over cases and attempts one at a time, so --n-concurrent (default 4) had no effect once --stop-on-pass was set. The CLI reference and the Tier 3 guide both describe --n-concurrent as "concurrent eval cases per agent", and the run plan shows the configured concurrency, so nothing told users their run was serialized. A dataset of N cases with up to K attempts could take up to N x K sequential trials per arm, rather than finishing in roughly N / n_concurrent rounds.

No public issue tracks this.

Kept from public

  • Public's _run_harbor contract is unchanged. Concurrent calls were already safe because each launch gets a private working directory. They now also happen within one arm.
  • Public's per-attempt job naming and error text are unchanged, as are _job_passed, which uses the collector's pass semantics, and _merge_attempt_jobs, with its hardened Harbor 0.24 merge and symlink and reparse checks.
  • fix(tier3): retain scores after verified timeout recovery #222's recovered-timeout handling is unchanged. A retained agent timeout followed by a matching completed attempt still drops that attempt's error. The filter now runs inside the per-case helper over that case's own errors. This is equivalent, because harbor_timeout_job_recovered only matches an earlier attempt of the same task (same task id and checksum).
  • Public's per-agent concurrency budget is unchanged for the non-stop-on-pass path. Public's run-level n_concurrent validation still rejects values below 1 before execution.
  • No new CLI flag or config key.
  • Left out: an opt-in global case scheduler (a separate case_concurrency setting that admits C cases across all agents and arms). It is a larger feature: new CLI and config surface, collector and progress changes, and its own documentation of peak trial counts. It is better proposed on its own, if wanted.
  • This branch edits the same loop in _run_stop_on_pass_variant as open PR feat(plugin): Add Plugin evaluation support across all tiers #28, so whichever merges second will need a small rebase. The per-attempt loop body is unchanged apart from moving into a per-case helper.

Tests

  • New tests/test_harbor_stop_on_pass_concurrency.py:
    • test_stop_on_pass_runs_cases_concurrently_with_serial_attempts[1|2|4] runs the real _run_agent_pair -> _run_stop_on_pass_variant -> _merge_attempt_jobs path with a filesystem-backed _run_harbor double that writes Harbor 0.24 JobResult and TrialResult files. A barrier proves that n_concurrent cases overlap, and peak concurrency equals n_concurrent. Attempts of one case never overlap, and attempt counts follow early stopping (a=1, b=2, c=1, d=3). All with-skill launches come before the baseline arm. Each merged arm result has all 7 trials in dataset order, even though later cases finish first. It fails on current main: the barrier times out because cases run serially.
    • test_stop_on_pass_failed_attempts_retry_only_their_case_in_dataset_order: a failed launch retries only its own case, and errors come back in dataset order.
    • test_stop_on_pass_unexpected_case_error_stops_queued_cases: an unexpected exception propagates, no later case launches, and no partial aggregate is merged.
  • tests/test_tier3_public_runtime.py::test_native_harbor_metadata_entry_id_seam_across_runner_collector_and_dataset_snapshot runs with the default n_concurrent=4. The test now checks launches per arm as a multiset, because the order of cases within an arm is no longer fixed. The arm ordering and attempt counts it checks are unchanged.
  • Rebased on current main, which includes fix(tier3): retain scores after verified timeout recovery #222. The stop-on-pass tests, fix(tier3): retain scores after verified timeout recovery #222's test_harbor_timeout_recovery.py and test_harbor_timeout_recovery_docker.py (which call _run_stop_on_pass_variant directly), test_tier3_public_runtime and test_harbor_collector_runtime_failures all pass: 491 passed.
  • Changed modules and their neighbours: 3,100 passed, 5 skipped, 14 failed. These were test_harbor_runner_status, test_harbor_runtime_preflight, test_harbor_runner_environment, test_harbor_runner_artifacts, test_harbor_local_mode, test_harbor_local_upload, test_harbor_runtime_skill_isolation, test_tier3_progress, test_tier3_case_summary, test_tier3_compare, test_tier3_config_key_parity, test_harbor_task_toml_retry_env, test_judge_lift_integrity, test_commands, tests/golden, tests/evaluation/test_tier3_benchmark_contract.py, tests/tier3/test_workflow.py, tests/tier3/test_judge_failure_artifacts.py, tests/tier3/test_judge_result_semantics.py and tests/reporting/test_tier3_scoped_reports.py, plus the docs, CI and CHANGELOG tests. All 14 failures also fail on an unmodified copy of main on this machine:
    • 13 tests in test_judge_failure_artifacts.py (test_generated_custom_only_script_*) run the generated grader with the host python3, which is 3.9 here, and that grader uses int | float.
    • test_bounded_harbor_process_timeout_preserves_redacted_diagnostic_tail gives the child process 0.1 s to write to stderr, which is too short on a loaded machine.
    • A further 22 timing-sensitive tests in test_harbor_runtime_preflight, test_harbor_local_mode and test_harbor_runner_status failed while other test runs loaded the machine. All 22 pass when rerun serially.
  • ruff check, ruff format --check on runner.py and the changed test files, and scripts/check_oss_boundary.py all pass.

🤖 Generated with Claude Code

With --stop-on-pass (or harbor.stop_on_pass: true), the runner never
passed n_concurrent to the stop-on-pass path, which then looped over
every case and attempt one at a time. --n-concurrent, documented as
concurrent eval cases per agent and shown in the run plan, silently had
no effect, so large evaluations took several times longer than the
configured concurrency allowed.

Run up to n_concurrent cases at once per arm on a bounded worker pool.
Each case still launches one single-trial Harbor job per attempt, and
its next attempt starts only after the previous one scored, stopping at
the first pass. The with-skill and without-skill arms still run one
after the other, each with the full per-agent budget. Attempt jobs and
errors are collected in dataset order, so the merged arm job stays
deterministic. An unexpected exception in one case stops later launches
and propagates without merging a partial aggregate, as the serial loop
did.

Document the stop-on-pass concurrency semantics in the Tier 3 guide.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff in full context. No findings. Attempts of a case stay sequential, the pool is bounded by min(n_concurrent, cases), merged attempt jobs keep dataset order, an unexpected error stops queued launches like the old serial loop, and the per-case error filtering for recovered timeouts is equivalent. The new concurrency tests (rendezvous barrier, ordering, error propagation) pass locally along with tests/test_tier3_public_runtime.py; ruff clean. Docs and CHANGELOG match the behavior.

Reviewed with Claude Code.

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read _run_stop_on_pass_variant and _run_agent_pair end to end and found nothing blocking. The pool is capped at min(n_concurrent, cases), each case's attempts stay sequential, and the stop flag is set before the exception propagates, so queued cases never launch (the n_concurrent=1 error test is deterministic for that reason). Concurrent _run_harbor calls are safe because each one copies run_env and gets its own working directory, and the per-case timeout-recovery filter is equivalent since a recovery only matches an earlier attempt of the same task. The docs example matches the default max_agents.

Resolve the CHANGELOG.md conflict: keep main's new Unreleased entry and
put this PR's entry after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 enabled auto-merge (squash) November 4, 2026 18:56
rng1995 and others added 3 commits November 5, 2026 00:31
Resolve runner.py conflicts with the Ctrl+C cancellation from #291: keep
both the PR's n_concurrent keyword and main's cancellation keyword on
_run_stop_on_pass_variant and on its call in _run_agent_pair. The PR's
per-case workers already pass cancellation to _run_harbor, so concurrent
stop-on-pass cases stop on Ctrl+C like the sequential path did.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the CHANGELOG.md conflict: keep main's install-retry entry (#277)
and add this PR's stop-on-pass entry after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 disabled auto-merge November 5, 2026 16:57
@rng1995
rng1995 enabled auto-merge (squash) November 5, 2026 16:57
@rng1995
rng1995 merged commit 3ad2838 into main Nov 5, 2026
22 checks passed
@rng1995
rng1995 deleted the naren/port-stop-on-pass-concurrency branch November 5, 2026 17:38
@rng1995 rng1995 mentioned this pull request Nov 6, 2026
7 of 8 tasks
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.

2 participants