Official Codebase of 3DCodeVerse
Python
ab_plan: cap children with the flat CV3D_MAX_IN_FLIGHT now that it is a real alias
gaoypenga88b0c5f99b1
diff --git a/harness/bench/ab_plan.py b/harness/bench/ab_plan.pyindex d52deba6..db45b9a5 100644--- a/harness/bench/ab_plan.py+++ b/harness/bench/ab_plan.py@@ -15,7 +15,7 @@ from the environment (``codeverse.tracks.brief.brief_enabled`` reads ``os.envirocall time; anything under ``Settings`` is read once through an ``lru_cache``), so twothreads in one interpreter cannot hold different values of them. A child gets exactlythe env its arm needs and nothing leaks across. Each child owns a key pool, so the-driver caps every child at ``CV3D_RATE__MAX_IN_FLIGHT`` (default 16) — two children at+driver caps every child at ``CV3D_MAX_IN_FLIGHT`` (default 16) — two children at16 stay inside the 64 knee measured for one process (``docs/COST.md`` §23).Why the arms launch as simultaneous PAIRS: provider weather changes by the hour, and a@@ -67,9 +67,11 @@ from bench.run_bench import Battery, BenchPrompt, select_prompts # noqa: E402DEFAULT_GENERATOR = "api-agent:gemini:gemini-3.7-flash"DEFAULT_JUDGE = "gemini:gemini-3.1-pro-preview"-#: the env name Settings actually reads (``Rate.max_in_flight`` under ``CV3D_`` + ``__``).-#: NOT ``CV3D_MAX_IN_FLIGHT``: that flat name is read by nothing.-MAX_IN_FLIGHT_ENV = "CV3D_RATE__MAX_IN_FLIGHT"+#: the per-child cap. The flat name is a first-class alias of ``CV3D_RATE__MAX_IN_FLIGHT``+#: since 2026-08-24 (``Settings._FLAT_ALIASES``; before that it was read by nothing) and+#: wins over the nested spelling when both are set, which is what makes ``setdefault``+#: below a real cap even when the launching shell exported the nested one at 64.+MAX_IN_FLIGHT_ENV = "CV3D_MAX_IN_FLIGHT"DEFAULT_MAX_IN_FLIGHT = 16#: only ever 2 — one control + one variant, launched together (see module docstring)PARALLEL = 2diff --git a/harness/tests/compare_bench/test_ab_plan.py b/harness/tests/compare_bench/test_ab_plan.pyindex 2e1d2a70..96655c32 100644--- a/harness/tests/compare_bench/test_ab_plan.py+++ b/harness/tests/compare_bench/test_ab_plan.py@@ -123,16 +123,17 @@ def test_variant_env_is_applied_to_the_variant_arm_only():assert "CV3D_PLAN_BRIEF" not in c, "the control must never inherit the switch under test"assert c["PATH"] == v["PATH"] == "/bin"assert c[MAX_IN_FLIGHT_ENV] == v[MAX_IN_FLIGHT_ENV] == "16"- assert MAX_IN_FLIGHT_ENV == "CV3D_RATE__MAX_IN_FLIGHT", "the name Settings.rate actually reads"# a cap set by the driver's own environment is respected, not overwrittenassert child_env(VARIANT, opts, {MAX_IN_FLIGHT_ENV: "4"})[MAX_IN_FLIGHT_ENV] == "4"assert child_env(VARIANT, opts, {})["PYTHONUNBUFFERED"] == "1"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_settingsmonkeypatch.setenv(MAX_IN_FLIGHT_ENV, "7")+ monkeypatch.setenv("CV3D_RATE__MAX_IN_FLIGHT", "64") # a shell-exported nested value must not winget_settings.cache_clear()try:assert get_settings().rate.max_in_flight == 7