Official Codebase of 3DCodeVerse
Python
ab_plan: --max-in-flight was silently discarded when the shell exported a cap
gaoypeng6358c0068d12
diff --git a/harness/bench/ab_plan.py b/harness/bench/ab_plan.pyindex 47ef27d0..b79ab634 100644--- a/harness/bench/ab_plan.py+++ b/harness/bench/ab_plan.py@@ -136,6 +136,11 @@ def parse_variant_env(items: Sequence[str]) -> dict[str, str]:k, sep, v = it.partition("=")if not sep or not k.strip():raise ValueError(f"--variant-env needs KEY=VALUE, got {it!r}")+ if k.strip() in (MAX_IN_FLIGHT_ENV, NESTED_MAX_IN_FLIGHT_ENV):+ # child_env sets the cap authoritatively so the §23 admission check and the+ # children agree; accepting it here too would silently discard one of them.+ raise ValueError(f"--variant-env {k.strip()} is not allowed: the in-flight cap is "+ f"the driver's (--max-in-flight), and the admission check budgets on it")out[k.strip()] = vreturn outdiff --git a/harness/tests/compare_bench/test_ab_plan.py b/harness/tests/compare_bench/test_ab_plan.pyindex d8b970ec..24abeb46 100644--- a/harness/tests/compare_bench/test_ab_plan.py+++ b/harness/tests/compare_bench/test_ab_plan.py@@ -212,6 +212,15 @@ def test_children_run_at_exactly_the_cap_the_budget_reserved(monkeypatch):assert inherited_max_in_flight() == DEFAULT_MAX_IN_FLIGHT+def test_the_in_flight_cap_cannot_be_smuggled_in_as_the_variant_switch():+ """It would put the arms at different caps and make the admission figure wrong again."""+ import pytest++ for name in (MAX_IN_FLIGHT_ENV, NESTED_MAX_IN_FLIGHT_ENV):+ with pytest.raises(ValueError, match="not allowed"):+ parse_variant_env([f"{name}=64"])++def test_the_in_flight_env_name_is_one_settings_reads(monkeypatch):"""A cap that Settings does not read is no cap: the children would run at 64 each."""from codeverse.config import get_settings