From 92f14f9664606a96bebb8c8bf9bf58f3ba80aa9c Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 10:36:49 -0400 Subject: [PATCH 01/48] ci(evals): allow multi-spec harbor_package_override Install one PEP 508 spec per line so an unreleased Harbor build can override both harbor and harbor-langsmith at once. Newline is the only safe delimiter since a spec contains spaces (name @ git+url); specs are collected into an array and passed as separate args, preserving the existing env-passed, no-eval injection safety. --- .github/workflows/_harbor_run.yml | 11 ++++++++++- .github/workflows/unified_evals.yml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index d59c7a10c32..558f2f05297 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -218,7 +218,16 @@ jobs: HARBOR_PACKAGE_OVERRIDE: ${{ inputs.harbor_package_override }} # --reinstall --refresh defeats any stale cached wheel for this git ref, # so re-running with the same override picks up a freshly-built package. - run: uv pip install --reinstall --refresh "$HARBOR_PACKAGE_OVERRIDE" + run: | + # One spec per line: a PEP 508 spec ("name @ git+url") contains spaces, + # so newline is the only safe delimiter. Collect into an array and pass + # as separate args — never re-split or eval'd, preserving injection + # safety — so a single install covers e.g. harbor + harbor-langsmith. + specs=() + while IFS= read -r line; do + [ -n "$line" ] && specs+=("$line") + done <<< "$HARBOR_PACKAGE_OVERRIDE" + uv pip install --reinstall --refresh "${specs[@]}" - name: "🔇 Suppress Harbor first-run tips" run: | diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index 312dd556257..0c2d9bbf906 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -37,7 +37,7 @@ on: type: boolean default: false harbor_package_override: - description: "Optional: install Harbor from an arbitrary package spec instead of the locked version, to test an unreleased Harbor build. Use a trusted package source. Prefer an immutable commit SHA, and never embed credentials in the package spec. Leave empty to use the pinned Harbor." + description: "Optional: install Harbor from an arbitrary package spec instead of the locked version, to test an unreleased Harbor build. One spec per line — e.g. `harbor @ git+…@` on the first line and `harbor-langsmith @ git+…@#subdirectory=packages/harbor-langsmith` on the second. Use a trusted package source. Prefer an immutable commit SHA, and never embed credentials in the package spec. Leave empty to use the pinned Harbor." type: string default: "" From 2d0fcd71ecd49e4645d77dbf8dc6dd889d644550 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 11:03:37 -0400 Subject: [PATCH 02/48] ci(evals): add bare-harness override to unified evals Add an `agent_impl` choice input (dcode|bare) to the unified workflow, threaded through unified_prep.py. It swaps the harness for the code categories (autonomous, context) only; conversation stays on tau3. Lets a run use the bare create_deep_agent graph, which avoids deepagents-code's reasoning_effort injection (that breaks function tools on models gated to the Responses API). Defaults to dcode; invalid values fail closed. --- .github/scripts/test_unified_prep.py | 39 ++++++++++++++++++++++++++++ .github/scripts/unified_prep.py | 20 ++++++++++++-- .github/workflows/unified_evals.yml | 8 ++++++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 323f5f066b3..65578b09200 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -72,6 +72,45 @@ def test_build_provider_matrices_cross_products_models_and_categories(): assert entry["n_shards"] == 3 +def test_dcode_impl_override_swaps_code_categories_only(): + # `dcode_impl` replaces the harness for the code categories (autonomous, + # context) but must leave the conversation category on tau3. + mats = up.build_provider_matrices( + ["openai:gpt"], + ["autonomous", "conversation", "context"], + shard_parallel=10, + n_shards_by_cat={"autonomous": 10, "conversation": 3, "context": 3}, + dcode_impl="bare", + ) + impls = {e["category"]: e["agent_impl"] for e in mats["openai"]} + assert impls == { + "autonomous": "bare", + "conversation": "tau3", + "context": "bare", + } + + +def test_dcode_impl_defaults_to_dcode(): + mats = up.build_provider_matrices( + ["openai:gpt"], + ["autonomous", "context"], + shard_parallel=10, + n_shards_by_cat={"autonomous": 10, "context": 3}, + ) + assert {e["agent_impl"] for e in mats["openai"]} == {"dcode"} + + +def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): + import pytest + + monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") + monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) + monkeypatch.setenv("UNIFIED_AGENT_IMPL", "deepagent") + with pytest.raises(SystemExit, match=r"UNIFIED_AGENT_IMPL must be one of"): + up.main() + + def test_langsmith_dataset_is_collision_resistant(): # slugify is lossy: these two distinct specs slugify to the same string, so # the hash suffix must keep their langsmith_dataset names distinct. diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index ff89fc7eda1..c2bb52fcda4 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -61,6 +61,10 @@ DEFAULT_N_SHARDS = {"autonomous": 10, "conversation": 3, "context": 3} +# Harnesses selectable for the code categories (autonomous, context) via the +# `agent_impl` input. Conversation is always tau3 and is never overridden. +CODE_AGENT_IMPLS = {"dcode", "bare"} + def parse_int_input( name: str, @@ -125,19 +129,23 @@ def build_provider_matrices( categories: list[str], shard_parallel: int, n_shards_by_cat: dict[str, int], + dcode_impl: str = "dcode", ) -> dict[str, list[dict]]: matrices: dict[str, list[dict]] = {} for spec in models_list: prov = provider_of(spec) for cat in categories: cm = CATEGORY_MAP[cat] + # `dcode_impl` swaps the harness for the code categories only; the + # conversation category's tau3 harness is left untouched. + agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] entry = { "model": spec, "provider": prov, "category": cat, "dataset": cm["dataset"], "dataset_path": cm["dataset_path"], - "agent_impl": cm["agent_impl"], + "agent_impl": agent_impl, # Per-model datasets isolate runs; unified_summary is the # cross-model comparison surface. "langsmith_dataset": f"{cm['ls_dataset']}__{slugify(spec)}-{_short_hash(spec)}", @@ -194,6 +202,14 @@ def main(argv: list[str] | None = None) -> int: for category, default in DEFAULT_N_SHARDS.items() } + # Empty defaults to "dcode" (the historical per-category default). + dcode_impl = os.environ.get("UNIFIED_AGENT_IMPL", "").strip() or "dcode" + if dcode_impl not in CODE_AGENT_IMPLS: + raise SystemExit( + f"UNIFIED_AGENT_IMPL must be one of {sorted(CODE_AGENT_IMPLS)}, " + f"got {dcode_impl!r}" + ) + if not categories: raise SystemExit(f"No categories selected. Choose from {sorted(CATEGORY_MAP)}.") unknown = [c for c in categories if c not in CATEGORY_MAP] @@ -223,7 +239,7 @@ def main(argv: list[str] | None = None) -> int: assert len(providers_present) * shard_parallel <= MAX_RUNNERS matrices = build_provider_matrices( - model_specs, categories, shard_parallel, n_shards_by_cat + model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl ) outputs: dict[str, object] = { diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index 0c2d9bbf906..cba82db3f81 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -11,6 +11,13 @@ on: description: "Comma list" type: string default: "autonomous,conversation,context" + agent_impl: + description: "Harness for the code categories (autonomous, context): 'dcode' (Deep Agents Code CLI) or 'bare' (bare create_deep_agent). Conversation always uses tau3." + type: choice + default: "dcode" + options: + - dcode + - bare rollouts: type: string default: "3" @@ -91,6 +98,7 @@ jobs: env: UNIFIED_MODELS: ${{ inputs.models }} UNIFIED_CATEGORIES: ${{ inputs.categories }} + UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} UNIFIED_SHARD_PARALLEL: ${{ inputs.shard_parallel }} UNIFIED_N_SHARDS_AUTONOMOUS: ${{ inputs.n_shards_autonomous }} From d21e9587a90563dd3ff51b1a95b676ac2b66e34a Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 11:14:21 -0400 Subject: [PATCH 03/48] fix(evals): use OpenAI Responses API in harbor langgraph agent The harbor langgraph agent builds models with init_chat_model directly, bypassing the deep-agents OpenAI provider profile. OpenAI's model profile defaults reasoning_effort for gpt-5.x, and OpenAI gates reasoning_effort + function tools to /v1/responses, so every trial 400'd on /v1/chat/completions (all harnesses: dcode, bare, tau3). Set use_responses_api=True for openai: models in a shared _build_model helper; a caller-supplied model_kwargs wins. --- .../langgraph_project/langgraph_agent.py | 23 +++++++-- .../unit_tests/test_harbor_langgraph_agent.py | 48 +++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py b/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py index b42451e897c..1eef4faa7d0 100644 --- a/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py +++ b/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py @@ -100,6 +100,23 @@ def _model_name(configurable: dict[str, object]) -> str: return value +def _build_model(configurable: dict[str, object]) -> object: + """Build the chat model, defaulting OpenAI to the Responses API. + + OpenAI gates ``reasoning_effort`` + function tools to ``/v1/responses`` for + gpt-5.x, and its model profile defaults ``reasoning_effort``. The model is + built here directly via ``init_chat_model``, which bypasses the Deep Agents + OpenAI provider profile that would set ``use_responses_api=True``, so set it + explicitly for ``openai:`` models. A caller-supplied ``model_kwargs`` value + still wins. + """ + name = _model_name(configurable) + kwargs = _model_kwargs(configurable) + if name.startswith("openai:") and "use_responses_api" not in kwargs: + kwargs["use_responses_api"] = True + return init_chat_model(name, **kwargs) + + def _workdir(configurable: dict[str, object]) -> Path: value = configurable.get("cwd") if value is None: @@ -130,7 +147,7 @@ def make_graph(config: dict[str, object] | None = None) -> object: ValueError: If no model name is provided. """ configurable = _configurable(config) - model = init_chat_model(_model_name(configurable), **_model_kwargs(configurable)) + model = _build_model(configurable) assistant_id = os.environ.get("HARBOR_SESSION_ID") or f"harbor-{uuid.uuid4()}" with _scrub_shell_env(): graph, _backend = create_cli_agent( @@ -169,7 +186,7 @@ def make_bare_graph(config: dict[str, object] | None = None) -> object: ValueError: If no model name is provided. """ configurable = _configurable(config) - model = init_chat_model(_model_name(configurable), **_model_kwargs(configurable)) + model = _build_model(configurable) backend = LocalShellBackend(root_dir=_workdir(configurable), inherit_env=False) return create_deep_agent( model=model, @@ -290,7 +307,7 @@ async def make_tau3_graph(config: dict[str, object] | None = None) -> object: ValueError: If no model name or MCP servers are provided. """ configurable = _configurable(config) - model = init_chat_model(_model_name(configurable), **_model_kwargs(configurable)) + model = _build_model(configurable) client = MultiServerMCPClient(_mcp_connections(configurable)) tools = await client.get_tools() return create_deep_agent( diff --git a/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py b/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py index 169175fbb25..797ef3abbbd 100644 --- a/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py +++ b/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py @@ -137,6 +137,54 @@ def test_make_graph_defaults_to_app_workdir(monkeypatch: pytest.MonkeyPatch) -> assert captured_create[0]["assistant_id"] +def test_make_graph_openai_defaults_to_responses_api( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + # OpenAI gates reasoning_effort + function tools to /v1/responses for + # gpt-5.x; the agent builds the model directly, so it must set + # use_responses_api=True itself. + captured_init: list[dict[str, object]] = [] + + def fake_init_chat_model(model: str, **kwargs: object) -> object: + captured_init.append({"model": model, "kwargs": kwargs}) + return "chat-model" + + monkeypatch.setattr(langgraph_agent, "init_chat_model", fake_init_chat_model) + monkeypatch.setattr( + langgraph_agent, "create_cli_agent", lambda **_kwargs: (object(), object()) + ) + + langgraph_agent.make_graph( + {"configurable": {"model": "openai:gpt-5.6-luna", "cwd": str(tmp_path)}} + ) + + assert captured_init == [ + {"model": "openai:gpt-5.6-luna", "kwargs": {"use_responses_api": True}} + ] + + +def test_build_model_respects_explicit_use_responses_api( + monkeypatch: pytest.MonkeyPatch, +) -> None: + captured_init: list[dict[str, object]] = [] + + monkeypatch.setattr( + langgraph_agent, + "init_chat_model", + lambda model, **kwargs: captured_init.append( + {"model": model, "kwargs": kwargs} + ), + ) + + langgraph_agent._build_model( + {"model": "openai:gpt-5", "model_kwargs": {"use_responses_api": False}} + ) + + assert captured_init == [ + {"model": "openai:gpt-5", "kwargs": {"use_responses_api": False}} + ] + + def test_make_bare_graph_builds_sdk_deepagent_with_local_shell( monkeypatch: pytest.MonkeyPatch, tmp_path: Path ) -> None: From 66f4e81387628a4cc77df440ecdc327b8d47a756 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 12:43:23 -0400 Subject: [PATCH 04/48] fix(evals): pass OPENAI_API_KEY to verifier env for LLM-judge tasks harbor-index verifiers are OpenAI LLM judges but only received OPENAI_BASE_URL, so they exited without writing a reward file (RewardFileNotFoundError) on both docker and langsmith sandboxes. Forward OPENAI_API_KEY to the verifier env (mirroring the always-on base URL), and grant the key to the job for harbor-index runs so non-openai agent models can still be judged. --- .github/workflows/_harbor_run.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 558f2f05297..feca1cd5b9d 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -147,7 +147,7 @@ jobs: LANGSMITH_SANDBOX_API_KEY: ${{ inputs.sandbox_env == 'langsmith' && secrets.LANGSMITH_SANDBOX_API_KEY || '' }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} - OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3')) && secrets.OPENAI_API_KEY || '' }} + OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} OPENROUTER_API_KEY: ${{ startsWith(matrix.model, 'openrouter:') && secrets.OPENROUTER_API_KEY || '' }} XAI_API_KEY: ${{ startsWith(matrix.model, 'xai:') && secrets.XAI_API_KEY || '' }} run: | @@ -303,7 +303,7 @@ jobs: LANGSMITH_SANDBOX_API_KEY: ${{ inputs.sandbox_env == 'langsmith' && secrets.LANGSMITH_SANDBOX_API_KEY || '' }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} - OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3')) && secrets.OPENAI_API_KEY || '' }} + OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} OPENROUTER_API_KEY: ${{ startsWith(matrix.model, 'openrouter:') && secrets.OPENROUTER_API_KEY || '' }} XAI_API_KEY: ${{ startsWith(matrix.model, 'xai:') && secrets.XAI_API_KEY || '' }} run: | @@ -562,6 +562,11 @@ jobs: ) verifier_env_args=( --verifier-env 'OPENAI_BASE_URL=${OPENAI_BASE_URL}' + # harbor-index (and other) verifiers are OpenAI LLM judges: they need + # the key, not just the base URL, or they exit without writing a + # reward file. Mirrors the always-on base URL above; forwards empty + # when the job wasn't granted a key (harmless for non-judge verifiers). + --verifier-env 'OPENAI_API_KEY=${OPENAI_API_KEY}' ) model_provider="${HARBOR_MODEL%%:*}" case "$model_provider" in From d164ee2b1f0f0f402799dcf581ba81ee0075f7d9 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 12:56:18 -0400 Subject: [PATCH 05/48] fix(evals): supply JUDGE_* config to harbor-index verifier env harbor-index verifiers run native_judge, which requires JUDGE_PROVIDER, JUDGE_MODELS, JUDGE_REPEATS, JUDGE_CONCURRENCY set 'by the job yaml' or it raises JudgeConfigurationError and writes no reward file. Wire an OpenAI judge into verifier_env_args (provider=openai, repeats/concurrency=1) with a configurable judge_models input (default gpt-5.6-luna). Prefer an independent grader, not the model under test, for real scorecards. --- .github/workflows/_harbor_run.yml | 14 ++++++++++++++ .github/workflows/harbor.yml | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index feca1cd5b9d..b24800112be 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -61,6 +61,12 @@ on: harbor_package_override: type: string default: "" + judge_models: + # Grader model(s) for LLM-judge verifiers (e.g. harbor-index), passed as + # JUDGE_MODELS with JUDGE_PROVIDER=openai. Prefer an independent grader, + # not the model under test, to avoid self-grading bias. + type: string + default: "gpt-5.6-luna" permissions: contents: read @@ -131,6 +137,7 @@ jobs: HARBOR_AGENT_IMPL: ${{ inputs.agent_impl }} HARBOR_MODEL: ${{ matrix.model }} HARBOR_LS_DATASET_OVERRIDE: ${{ inputs.langsmith_dataset }} + HARBOR_JUDGE_MODELS: ${{ inputs.judge_models || 'gpt-5.6-luna' }} LANGSMITH_TRACING: "true" OPENAI_BASE_URL: "https://api.openai.com/v1" OLLAMA_HOST: "https://ollama.com" @@ -567,6 +574,13 @@ jobs: # reward file. Mirrors the always-on base URL above; forwards empty # when the job wasn't granted a key (harmless for non-judge verifiers). --verifier-env 'OPENAI_API_KEY=${OPENAI_API_KEY}' + # native_judge config the harbor-index verifiers require ("set by the + # job yaml"); without these the judge raises JudgeConfigurationError + # and writes no reward. Non-judge verifiers ignore the unused vars. + --verifier-env 'JUDGE_PROVIDER=openai' + --verifier-env "JUDGE_MODELS=$HARBOR_JUDGE_MODELS" + --verifier-env 'JUDGE_REPEATS=1' + --verifier-env 'JUDGE_CONCURRENCY=1' ) model_provider="${HARBOR_MODEL%%:*}" case "$model_provider" in diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 11689e342b3..e425ae6ae9e 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -184,6 +184,11 @@ on: required: false default: "" type: string + judge_models: + description: "Grader model for LLM-judge verifiers (e.g. harbor-index), used with an OpenAI judge. Prefer an independent grader, not the model under test." + required: false + default: "gpt-5.6-luna" + type: string permissions: contents: read # Lets the called reusable workflow manage run artifacts; a caller caps the @@ -326,3 +331,4 @@ jobs: disable_verification: ${{ inputs.disable_verification }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + judge_models: ${{ inputs.judge_models }} From 6163713ad4558bf0e0e36ecf288440d767017df7 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 13:11:07 -0400 Subject: [PATCH 06/48] fix(evals): expose env_build_timeout_multiplier for heavy cold builds harbor-index tasks with large base images + capsule downloads (e.g. bix*) exceed their environment.build_timeout_sec on the first cold snapshot build and hit EnvironmentStartTimeoutError. Plumb --environment-build-timeout-multiplier as an input (default 1.0). Raising it for a one-time cold build lets it finish; the content-addressed (force_build=false) snapshot then persists so subsequent runs cache-hit at 1.0. --- .github/workflows/_harbor_run.yml | 14 ++++++++++++++ .github/workflows/harbor.yml | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index b24800112be..19e54161371 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -52,6 +52,14 @@ on: agent_timeout_multiplier: type: string default: "1.0" + env_build_timeout_multiplier: + # Scales each task's environment.build_timeout_sec. Heavy first-time + # (cold) snapshot builds — e.g. harbor-index bix* (big base image + HF + # capsule download) — exceed the default and hit EnvironmentStartTimeoutError. + # Raise this for a one-time cold build; the content-addressed snapshot then + # persists so later runs cache-hit at 1.0. + type: string + default: "1.0" disable_verification: type: boolean default: false @@ -127,6 +135,7 @@ jobs: HARBOR_ROLLOUTS_PER_TASK: ${{ inputs.rollouts }} HARBOR_N_RETRIES: ${{ inputs.n_retries || '0' }} HARBOR_AGENT_TIMEOUT_MULTIPLIER: ${{ inputs.agent_timeout_multiplier || '1.0' }} + HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER: ${{ inputs.env_build_timeout_multiplier || '1.0' }} HARBOR_DISABLE_VERIFICATION: ${{ inputs.disable_verification || 'false' }} HARBOR_FORCE_BUILD: ${{ inputs.force_build || 'false' }} HARBOR_SHARD_INDEX: ${{ matrix.shard }} @@ -362,6 +371,10 @@ jobs: echo "::error::Invalid agent_timeout_multiplier (must be a positive decimal): $HARBOR_AGENT_TIMEOUT_MULTIPLIER" exit 1 fi + if ! [[ "$HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" =~ ^[0-9]+(\.[0-9]+)?$ ]] || [[ "$HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" =~ ^0+(\.0+)?$ ]]; then + echo "::error::Invalid env_build_timeout_multiplier (must be a positive decimal): $HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" + exit 1 + fi # Allowlist the boolean; only literal true/false accepted. verification_flag=() case "$HARBOR_DISABLE_VERIFICATION" in @@ -616,6 +629,7 @@ jobs: --n-attempts "$HARBOR_ROLLOUTS_PER_TASK" \ --max-retries "$HARBOR_N_RETRIES" \ --agent-timeout-multiplier "$HARBOR_AGENT_TIMEOUT_MULTIPLIER" \ + --environment-build-timeout-multiplier "$HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" \ "${verification_flag[@]}" \ "${force_build_flag[@]}" \ $n_tasks_flag \ diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index e425ae6ae9e..3356ec9fe73 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -164,6 +164,11 @@ on: required: false default: "1.0" type: string + env_build_timeout_multiplier: + description: "Multiplier for each task's environment build timeout. Raise (e.g. 4) for a one-time cold build of heavy-image tasks (e.g. harbor-index bix*) that otherwise hit EnvironmentStartTimeoutError; the content-addressed snapshot then persists and later runs cache-hit at 1.0." + required: false + default: "1.0" + type: string disable_verification: description: "Skip the task verifier (tests). For setup/concurrency stress tests where task pass/fail is not the goal." required: false @@ -328,6 +333,7 @@ jobs: n_tasks: ${{ inputs.n_tasks }} include_tasks: ${{ inputs.include_tasks }} agent_timeout_multiplier: ${{ inputs.agent_timeout_multiplier }} + env_build_timeout_multiplier: ${{ inputs.env_build_timeout_multiplier }} disable_verification: ${{ inputs.disable_verification }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} From e0eebf233a5f115d6b80381c86d74b678e954e43 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 14:11:11 -0400 Subject: [PATCH 07/48] fix(evals): expose override_storage_mb to raise snapshot fs above 32GiB Heavy harbor-index images exhaust the LangSmith snapshot filesystem (harbor's 32 GiB floor) during the layer-copy build and fail with a masked 'Snapshot creation failed. Please retry.'. Plumb harbor's --override-storage-mb as an input (0 = default) so heavy tasks can build with e.g. 64 GiB. (Distinct from env_build_timeout_multiplier, which only extends harbor's client-side wait, not the server build.) --- .github/workflows/_harbor_run.yml | 24 +++++++++++++++++++----- .github/workflows/harbor.yml | 8 +++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 19e54161371..16ba18d2346 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -53,13 +53,16 @@ on: type: string default: "1.0" env_build_timeout_multiplier: - # Scales each task's environment.build_timeout_sec. Heavy first-time - # (cold) snapshot builds — e.g. harbor-index bix* (big base image + HF - # capsule download) — exceed the default and hit EnvironmentStartTimeoutError. - # Raise this for a one-time cold build; the content-addressed snapshot then - # persists so later runs cache-hit at 1.0. + # Scales each task's environment.build_timeout_sec (harbor's client-side + # wait). Note: it does NOT extend the LangSmith build service's own limit. type: string default: "1.0" + override_storage_mb: + # Raises the sandbox snapshot filesystem above harbor's 32 GiB floor. + # Heavy harbor-index images (big base + layer copies) exhaust 32 GiB and + # fail the LangSmith snapshot build; e.g. 65536 = 64 GiB. 0 = don't override. + type: string + default: "0" disable_verification: type: boolean default: false @@ -136,6 +139,7 @@ jobs: HARBOR_N_RETRIES: ${{ inputs.n_retries || '0' }} HARBOR_AGENT_TIMEOUT_MULTIPLIER: ${{ inputs.agent_timeout_multiplier || '1.0' }} HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER: ${{ inputs.env_build_timeout_multiplier || '1.0' }} + HARBOR_OVERRIDE_STORAGE_MB: ${{ inputs.override_storage_mb || '0' }} HARBOR_DISABLE_VERIFICATION: ${{ inputs.disable_verification || 'false' }} HARBOR_FORCE_BUILD: ${{ inputs.force_build || 'false' }} HARBOR_SHARD_INDEX: ${{ matrix.shard }} @@ -375,6 +379,15 @@ jobs: echo "::error::Invalid env_build_timeout_multiplier (must be a positive decimal): $HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" exit 1 fi + # Non-negative integer; 0 means "don't override" (use the task's default). + if ! [[ "$HARBOR_OVERRIDE_STORAGE_MB" =~ ^[0-9]+$ ]]; then + echo "::error::Invalid override_storage_mb (must be a non-negative integer): $HARBOR_OVERRIDE_STORAGE_MB" + exit 1 + fi + storage_flag=() + if [ "$HARBOR_OVERRIDE_STORAGE_MB" != "0" ]; then + storage_flag=(--override-storage-mb "$HARBOR_OVERRIDE_STORAGE_MB") + fi # Allowlist the boolean; only literal true/false accepted. verification_flag=() case "$HARBOR_DISABLE_VERIFICATION" in @@ -632,6 +645,7 @@ jobs: --environment-build-timeout-multiplier "$HARBOR_ENV_BUILD_TIMEOUT_MULTIPLIER" \ "${verification_flag[@]}" \ "${force_build_flag[@]}" \ + "${storage_flag[@]}" \ $n_tasks_flag \ "${include_args[@]}" \ "${agent_env_args[@]}" \ diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 3356ec9fe73..7fbfe351a96 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -165,10 +165,15 @@ on: default: "1.0" type: string env_build_timeout_multiplier: - description: "Multiplier for each task's environment build timeout. Raise (e.g. 4) for a one-time cold build of heavy-image tasks (e.g. harbor-index bix*) that otherwise hit EnvironmentStartTimeoutError; the content-addressed snapshot then persists and later runs cache-hit at 1.0." + description: "Multiplier for each task's environment build timeout (harbor's client-side wait). Note: does not extend the LangSmith build service's own limit." required: false default: "1.0" type: string + override_storage_mb: + description: "Override the sandbox snapshot filesystem size (MB), raising harbor's 32 GiB floor. Use for heavy harbor-index images that fail the LangSmith snapshot build by exhausting storage (e.g. 65536 = 64 GiB). 0 = don't override." + required: false + default: "0" + type: string disable_verification: description: "Skip the task verifier (tests). For setup/concurrency stress tests where task pass/fail is not the goal." required: false @@ -334,6 +339,7 @@ jobs: include_tasks: ${{ inputs.include_tasks }} agent_timeout_multiplier: ${{ inputs.agent_timeout_multiplier }} env_build_timeout_multiplier: ${{ inputs.env_build_timeout_multiplier }} + override_storage_mb: ${{ inputs.override_storage_mb }} disable_verification: ${{ inputs.disable_verification }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} From db746e9fcf0d08240429fa871a3e5262f28328b7 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 18:57:19 -0400 Subject: [PATCH 08/48] fix(evals): drop LANGSMITH_SANDBOX_API_KEY; use LANGSMITH_API_KEY for sandbox The LangSmith sandbox + Client should authenticate with the standard LANGSMITH_API_KEY, not a separate LANGSMITH_SANDBOX_API_KEY (which routed to a different tenant). Remove it from deepagents_harbor.resolve_langsmith_api_key precedence and from the workflow env + credential check; LANGSMITH_API_KEY (always set) covers both. Update tests accordingly. --- .github/workflows/_harbor_run.yml | 5 +---- .github/workflows/harbor.yml | 3 +-- libs/evals/deepagents_harbor/langsmith.py | 9 ++++----- .../unit_tests/test_harbor_langsmith_integration.py | 2 -- libs/evals/tests/unit_tests/test_langsmith.py | 7 ++++--- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 16ba18d2346..9950ffa4dfe 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -164,7 +164,6 @@ jobs: GOOGLE_API_KEY: ${{ startsWith(matrix.model, 'google_genai:') && secrets.GOOGLE_API_KEY || '' }} GROQ_API_KEY: ${{ startsWith(matrix.model, 'groq:') && secrets.GROQ_API_KEY || '' }} LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} - LANGSMITH_SANDBOX_API_KEY: ${{ inputs.sandbox_env == 'langsmith' && secrets.LANGSMITH_SANDBOX_API_KEY || '' }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} @@ -181,8 +180,7 @@ jobs: docker) ;; # No additional credentials needed langsmith) - [ -z "$LANGSMITH_SANDBOX_API_KEY" ] && missing+=("LANGSMITH_SANDBOX_API_KEY") - ;; + ;; # Uses LANGSMITH_API_KEY (already required above) *) echo "::error::Unknown sandbox environment: $HARBOR_SANDBOX_ENV" exit 1 @@ -320,7 +318,6 @@ jobs: GOOGLE_API_KEY: ${{ startsWith(matrix.model, 'google_genai:') && secrets.GOOGLE_API_KEY || '' }} GROQ_API_KEY: ${{ startsWith(matrix.model, 'groq:') && secrets.GROQ_API_KEY || '' }} LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} - LANGSMITH_SANDBOX_API_KEY: ${{ inputs.sandbox_env == 'langsmith' && secrets.LANGSMITH_SANDBOX_API_KEY || '' }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 7fbfe351a96..5cbcf1cec69 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -9,8 +9,7 @@ # Ollama Cloud inference; it is not read from secrets. # # Required secrets (vary by sandbox + model provider): -# LANGSMITH_API_KEY — experiment tracking (always required) -# LANGSMITH_SANDBOX_API_KEY — needed for LangSmith sandbox +# LANGSMITH_API_KEY — experiment tracking + LangSmith sandbox (always required) # ANTHROPIC_API_KEY — needed for Anthropic models # OPENAI_API_KEY — needed for OpenAI models and tau3 verifier/user simulator # GOOGLE_API_KEY — needed for Google models diff --git a/libs/evals/deepagents_harbor/langsmith.py b/libs/evals/deepagents_harbor/langsmith.py index 6baf5396958..28150302b92 100644 --- a/libs/evals/deepagents_harbor/langsmith.py +++ b/libs/evals/deepagents_harbor/langsmith.py @@ -36,7 +36,7 @@ LANGSMITH_API_URL = os.getenv("LANGSMITH_ENDPOINT", "https://api.smith.langchain.com") """Base URL for LangSmith API requests, overridable via `LANGSMITH_ENDPOINT`.""" -_API_KEY_ENV_VARS = ("LANGSMITH_SANDBOX_API_KEY", "LANGSMITH_API_KEY", "LANGCHAIN_API_KEY") +_API_KEY_ENV_VARS = ("LANGSMITH_API_KEY", "LANGCHAIN_API_KEY") """Environment variables checked (in priority order) when resolving an API key.""" _FEEDBACK_MAX_WORKERS = 8 @@ -59,9 +59,8 @@ def download_dataset( def resolve_langsmith_api_key() -> tuple[str, str] | None: """Resolve the LangSmith API key from environment variables. - Checks, in order: `LANGSMITH_SANDBOX_API_KEY`, `LANGSMITH_API_KEY`, - `LANGCHAIN_API_KEY`. Returns a `(value, env_var_name)` tuple for the - first non-empty value, or `None`. + Checks, in order: `LANGSMITH_API_KEY`, `LANGCHAIN_API_KEY`. Returns a + `(value, env_var_name)` tuple for the first non-empty value, or `None`. """ for var in _API_KEY_ENV_VARS: value = os.getenv(var) @@ -109,7 +108,7 @@ def _headers() -> dict[str, str]: if not result: msg = ( "No LangSmith API key found. Set one of: " - "LANGSMITH_SANDBOX_API_KEY, LANGSMITH_API_KEY, LANGCHAIN_API_KEY." + "LANGSMITH_API_KEY, LANGCHAIN_API_KEY." ) raise ValueError(msg) return {"x-api-key": result[0]} diff --git a/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py b/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py index 711bb8115e2..038a4a301ae 100644 --- a/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py +++ b/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py @@ -141,7 +141,6 @@ def test_harbor_workflow_scopes_secrets_to_runtime_steps() -> None: "GOOGLE_API_KEY", "GROQ_API_KEY", "LANGSMITH_API_KEY", - "LANGSMITH_SANDBOX_API_KEY", "NVIDIA_API_KEY", "OLLAMA_API_KEY", "OPENAI_API_KEY", @@ -152,7 +151,6 @@ def test_harbor_workflow_scopes_secrets_to_runtime_steps() -> None: assert "secrets." not in install_step assert "LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}" in run_step - assert "inputs.sandbox_env == 'langsmith'" in run_step assert "startsWith(matrix.model, 'fireworks:')" in run_step assert "startsWith(matrix.model, 'ollama:')" in run_step diff --git a/libs/evals/tests/unit_tests/test_langsmith.py b/libs/evals/tests/unit_tests/test_langsmith.py index 3579bc6acab..0eb4317de4e 100644 --- a/libs/evals/tests/unit_tests/test_langsmith.py +++ b/libs/evals/tests/unit_tests/test_langsmith.py @@ -64,13 +64,14 @@ def test_returns_none_when_no_vars_set(self, monkeypatch: pytest.MonkeyPatch) -> monkeypatch.delenv("LANGCHAIN_API_KEY", raising=False) assert resolve_langsmith_api_key() is None - def test_returns_sandbox_key_first(self, monkeypatch: pytest.MonkeyPatch) -> None: + def test_ignores_sandbox_key(self, monkeypatch: pytest.MonkeyPatch) -> None: + # LANGSMITH_SANDBOX_API_KEY is intentionally NOT used; LANGSMITH_API_KEY wins. monkeypatch.setenv("LANGSMITH_SANDBOX_API_KEY", "sandbox-key") monkeypatch.setenv("LANGSMITH_API_KEY", "ls-key") monkeypatch.setenv("LANGCHAIN_API_KEY", "lc-key") value, name = resolve_langsmith_api_key() # ty: ignore[not-iterable] - assert value == "sandbox-key" - assert name == "LANGSMITH_SANDBOX_API_KEY" + assert value == "ls-key" + assert name == "LANGSMITH_API_KEY" def test_falls_back_to_langsmith_key(self, monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.delenv("LANGSMITH_SANDBOX_API_KEY", raising=False) From 13abdf2faf5fa9f7265a322a119d60b399068259 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 20:23:31 -0400 Subject: [PATCH 09/48] fix(evals): land unified experiments on shared datasets, not per-model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unified_prep minted a per-model LangSmith dataset (harbor-index__-) per run, duplicating examples and preventing cross-model comparison — and the per-model override name broke the context (local-dataset) experiment attach (dataset synced, 0 sessions). Pass empty langsmith_dataset so the leaf derives the canonical shared dataset per category (harbor-index/harbor-index-1.0, tau3-subset, local/datasets-context-retrieval-evals); each model is then an experiment on the one dataset. Removes now-dead ls_dataset/slugify/_short_hash + updates tests. --- .github/scripts/test_unified_prep.py | 29 ++++++++++------------------ .github/scripts/unified_prep.py | 24 +++++------------------ 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 65578b09200..a6d07280d1d 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -16,13 +16,6 @@ def test_parse_int_input_enforces_inclusive_range(): up.parse_int_input("UNIFIED_CONCURRENCY", raw, minimum=1, maximum=40) -def test_slugify_replaces_colons_and_slashes(): - assert up.slugify("anthropic:claude-opus-4-7") == "anthropic-claude-opus-4-7" - assert up.slugify("fireworks:accounts/fireworks/models/glm-5p2") == ( - "fireworks-accounts-fireworks-models-glm-5p2" - ) - - def test_provider_of_uses_prefix_and_falls_back_to_other(): known = {"anthropic", "openai"} assert up.provider_of("anthropic:claude-opus-4-7", known) == "anthropic" @@ -65,10 +58,8 @@ def test_build_provider_matrices_cross_products_models_and_categories(): ) assert entry["dataset_path"] == "datasets/context-retrieval-evals" assert entry["agent_impl"] == "dcode" - # readable slug + short hash suffix for collision resistance - assert entry["langsmith_dataset"].startswith( - "context-retrieval-evals__anthropic-opus-" - ) + # Shared dataset: empty so the leaf derives the canonical per-category name. + assert entry["langsmith_dataset"] == "" assert entry["n_shards"] == 3 @@ -111,16 +102,16 @@ def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): up.main() -def test_langsmith_dataset_is_collision_resistant(): - # slugify is lossy: these two distinct specs slugify to the same string, so - # the hash suffix must keep their langsmith_dataset names distinct. - a, b = "openrouter:foo/bar", "openrouter:foo-bar" - assert up.slugify(a) == up.slugify(b) +def test_langsmith_dataset_is_empty_for_shared_dataset(): + # No per-model dataset name: the leaf derives the canonical shared dataset, + # so every entry's langsmith_dataset is empty regardless of the model spec. mats = up.build_provider_matrices( - [a, b], ["context"], shard_parallel=10, n_shards_by_cat={"context": 3} + ["openrouter:foo/bar", "openrouter:foo-bar"], + ["context"], + shard_parallel=10, + n_shards_by_cat={"context": 3}, ) - names = {e["langsmith_dataset"] for e in mats["openrouter"]} - assert len(names) == 2 # distinct despite identical slugs + assert all(e["langsmith_dataset"] == "" for e in mats["openrouter"]) def test_main_dedupes_repeated_categories(tmp_path, monkeypatch): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index c2bb52fcda4..3c4a3037ab9 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -12,10 +12,8 @@ from __future__ import annotations -import hashlib import json import os -import re import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) @@ -43,19 +41,16 @@ "dataset": "harbor-index/harbor-index-1.0", "dataset_path": "", "agent_impl": "dcode", - "ls_dataset": "harbor-index", }, "conversation": { "dataset": "tau3-subset", "dataset_path": "", "agent_impl": "tau3", - "ls_dataset": "tau3-subset", }, "context": { "dataset": "", "dataset_path": "datasets/context-retrieval-evals", "agent_impl": "dcode", - "ls_dataset": "context-retrieval-evals", }, } @@ -99,17 +94,6 @@ def parse_int_input( return value -def slugify(spec: str) -> str: - return re.sub(r"[^a-zA-Z0-9]+", "-", spec).strip("-").lower() - - -def _short_hash(value: str) -> str: - # slugify is lossy (e.g. "foo/bar" and "foo-bar" collapse to the same slug), - # so distinct specs can produce identical names. Append a short hash of the - # raw value to keep dataset/artifact names unique. - return hashlib.sha256(value.encode()).hexdigest()[:8] - - def provider_of(spec: str, known: set[str] = KNOWN_PROVIDERS) -> str: prefix = spec.split(":", 1)[0] return prefix if prefix in known else "other" @@ -146,9 +130,11 @@ def build_provider_matrices( "dataset": cm["dataset"], "dataset_path": cm["dataset_path"], "agent_impl": agent_impl, - # Per-model datasets isolate runs; unified_summary is the - # cross-model comparison surface. - "langsmith_dataset": f"{cm['ls_dataset']}__{slugify(spec)}-{_short_hash(spec)}", + # Empty: the leaf derives the canonical shared dataset name per + # category (harbor-index/harbor-index-1.0, tau3-subset, + # local/...), so every model attaches as an experiment on the one + # shared dataset. unified_summary remains the cross-model surface. + "langsmith_dataset": "", "n_shards": n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]), "shard_parallel": shard_parallel, } From f3bc5e9367cb9ba35379f888b7a5310c0083b2a1 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 21:29:57 -0400 Subject: [PATCH 10/48] feat(evals): add lite profile to unified evals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit profile=lite runs a frozen high-signal task subset per category (lite_tasks.py: autonomous 15, conversation 11, context 8) at FULL rollouts — biased to the difficulty frontier (partial-pass / hard-but-solvable on a weaker model), excluding saturated + verifier-unstable tasks. unified_prep sets per-category include_tasks + right-sizes n_shards; unified_evals threads include_tasks to each eval job; the tau3-subset step now respects a caller include_tasks (lite wins). --- .github/scripts/lite_tasks.py | 67 ++++++++++++++++++++++++++++ .github/scripts/test_unified_prep.py | 37 +++++++++++++++ .github/scripts/unified_prep.py | 24 +++++++++- .github/workflows/_harbor_run.yml | 36 +++++++++------ .github/workflows/unified_evals.yml | 19 ++++++++ 5 files changed, 167 insertions(+), 16 deletions(-) create mode 100644 .github/scripts/lite_tasks.py diff --git a/.github/scripts/lite_tasks.py b/.github/scripts/lite_tasks.py new file mode 100644 index 00000000000..e72b8b50664 --- /dev/null +++ b/.github/scripts/lite_tasks.py @@ -0,0 +1,67 @@ +"""Frozen 'lite' task subsets per category for the unified evals `profile=lite`. + +A high-signal, low-cost slice: fewer tasks, FULL rollouts. Tasks are biased to the +difficulty frontier (partial-pass / hard-but-solvable) measured on a weaker model +(gpt-5.6-luna); saturated (all-pass) and verifier-unstable tasks are excluded. + +Names are the exact harbor `--include-task-name` filters per category: + autonomous -> registry ref `harbor-index/` + conversation -> `sierra-research/tau3-bench__` (same form as tau3_subset) + context -> local task dir basename `cb-cloud-` + +`include_tasks(category)` returns the space-separated string the workflow passes to +`_harbor_run.yml`. Keep this list under review; re-calibrate as models/tasks change. +""" + +from __future__ import annotations + +LITE_TASKS: dict[str, list[str]] = { + # 15 — luna is weak here, so a rich frontier: partials + hard-but-solvable. + "autonomous": [ + "harbor-index/replicationbench-find-galactic-vz-peaks", + "harbor-index/swebenchverified-fix-span-selector-axes-limits", + "harbor-index/omnimath-find-perfect-square-functions", + "harbor-index/usaco-assign-cows-to-barns", + "harbor-index/featurebench-add-feature-mlflow-bedrock-autolog", + "harbor-index/bix-filter-chip-variants", + "harbor-index/tb-dna-insert", + "harbor-index/swebenchverified-fix-django-mti-parent-link", + "harbor-index/bix-ordinal-logit-covid", + "harbor-index/labbench-habenula-fluorescence-change", + "harbor-index/labbench-read-asap2f-step-response", + "harbor-index/gso-speedup-pydantic-enum", + "harbor-index/swebenchpro-fix-file-suffix-chooser", + "harbor-index/spider2-dbt-airport-arrivals", + "harbor-index/arcagi2-grid-transform-a32d", + ], + # 11 — luna is weak on banking (rich frontier); telecom is saturated (1 kept). + "conversation": [ + "sierra-research/tau3-bench__tau3-banking_knowledge-task-043", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-056", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-093", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-018", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-029", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-040", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-048", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-061", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-072", + "sierra-research/tau3-bench__tau3-banking_knowledge-task-073", + "sierra-research/tau3-bench__tau3-telecom-service-issue-airplane-mode-on-break-apn-settings-lock-sim-card-pin-overdue-bill-suspension-unseat-sim-card-persona-none", + ], + # 8 — luna is strong on context, so the frontier is thin: its partials + fails. + "context": [ + "cb-cloud-10", + "cb-cloud-41", + "cb-cloud-47", + "cb-cloud-0", + "cb-cloud-26", + "cb-cloud-49", + "cb-cloud-15", + "cb-cloud-5", + ], +} + + +def include_tasks(category: str) -> str: + """Space-separated include-task filter string for a category, or '' if none.""" + return " ".join(LITE_TASKS.get(category, [])) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index a6d07280d1d..0f908de3d9b 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -102,6 +102,43 @@ def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): up.main() +def test_full_profile_has_empty_include_tasks(): + mats = up.build_provider_matrices( + ["openai:gpt"], ["autonomous"], shard_parallel=10, n_shards_by_cat={"autonomous": 10} + ) + assert mats["openai"][0]["include_tasks"] == "" + + +def test_lite_profile_sets_include_tasks_and_right_sizes_shards(): + import lite_tasks + + defaults = {"autonomous": 10, "conversation": 3, "context": 3} + mats = up.build_provider_matrices( + ["openai:gpt"], + ["autonomous", "conversation", "context"], + shard_parallel=10, + n_shards_by_cat=defaults, + dcode_impl="bare", + profile="lite", + ) + by_cat = {e["category"]: e for e in mats["openai"]} + for cat in ("autonomous", "conversation", "context"): + n = len(lite_tasks.LITE_TASKS[cat]) + assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) + assert by_cat[cat]["n_shards"] == min(defaults[cat], max(1, (n + 4) // 5)) + + +def test_main_rejects_invalid_profile(tmp_path, monkeypatch): + import pytest + + monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") + monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) + monkeypatch.setenv("UNIFIED_PROFILE", "medium") + with pytest.raises(SystemExit, match=r"UNIFIED_PROFILE must be one of"): + up.main() + + def test_langsmith_dataset_is_empty_for_shared_dataset(): # No per-model dataset name: the leaf derives the canonical shared dataset, # so every entry's langsmith_dataset is empty regardless of the model spec. diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 3c4a3037ab9..de6848660bc 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -17,6 +17,7 @@ import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import lite_tasks # noqa: E402 (lite_tasks.py in same dir) import models # noqa: E402 (models.py in same dir) import shard_matrix # noqa: E402 (shard_matrix.py in same dir) @@ -60,6 +61,10 @@ # `agent_impl` input. Conversation is always tau3 and is never overridden. CODE_AGENT_IMPLS = {"dcode", "bare"} +# Run profiles: "full" = every task in each category; "lite" = the frozen +# high-signal subset from lite_tasks.py (fewer tasks, full rollouts). +PROFILES = {"full", "lite"} + def parse_int_input( name: str, @@ -114,6 +119,7 @@ def build_provider_matrices( shard_parallel: int, n_shards_by_cat: dict[str, int], dcode_impl: str = "dcode", + profile: str = "full", ) -> dict[str, list[dict]]: matrices: dict[str, list[dict]] = {} for spec in models_list: @@ -123,6 +129,13 @@ def build_provider_matrices( # `dcode_impl` swaps the harness for the code categories only; the # conversation category's tau3 harness is left untouched. agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] + # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks); + # right-size shards so a ~15-task slice doesn't spin 10 runners. + include = lite_tasks.include_tasks(cat) if profile == "lite" else "" + n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) + if include: + n_tasks = len(include.split()) + n_shards = min(n_shards, max(1, (n_tasks + 4) // 5)) entry = { "model": spec, "provider": prov, @@ -130,12 +143,13 @@ def build_provider_matrices( "dataset": cm["dataset"], "dataset_path": cm["dataset_path"], "agent_impl": agent_impl, + "include_tasks": include, # Empty: the leaf derives the canonical shared dataset name per # category (harbor-index/harbor-index-1.0, tau3-subset, # local/...), so every model attaches as an experiment on the one # shared dataset. unified_summary remains the cross-model surface. "langsmith_dataset": "", - "n_shards": n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]), + "n_shards": n_shards, "shard_parallel": shard_parallel, } matrices.setdefault(prov, []).append(entry) @@ -196,6 +210,12 @@ def main(argv: list[str] | None = None) -> int: f"got {dcode_impl!r}" ) + profile = os.environ.get("UNIFIED_PROFILE", "").strip() or "full" + if profile not in PROFILES: + raise SystemExit( + f"UNIFIED_PROFILE must be one of {sorted(PROFILES)}, got {profile!r}" + ) + if not categories: raise SystemExit(f"No categories selected. Choose from {sorted(CATEGORY_MAP)}.") unknown = [c for c in categories if c not in CATEGORY_MAP] @@ -225,7 +245,7 @@ def main(argv: list[str] | None = None) -> int: assert len(providers_present) * shard_parallel <= MAX_RUNNERS matrices = build_provider_matrices( - model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl + model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl, profile ) outputs: dict[str, object] = { diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 9950ffa4dfe..ce1eccda9eb 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -262,26 +262,34 @@ jobs: # dedicated "tau3-subset" LangSmith dataset name. if: env.HARBOR_DATASET == 'tau3-subset' run: | - include_tasks="$(uv run python -c 'from deepagents_evals.tau3_subset import INCLUDE_TASKS; print(INCLUDE_TASKS)')" - # Fail loudly if the filter resolved to the wrong size. An import error - # already aborts via `set -e` (a bare assignment propagates the command - # substitution's exit code — do not switch to `local`/`export`, which - # swallow it), but a successful-but-empty/partial result would be - # written verbatim and silently run a different set than the promised - # "30-task subset" — an empty value means NO filter, i.e. the FULL - # dataset, still mislabeled as tau3-subset in LangSmith. 30 is the same - # invariant the unit tests pin; change both together. - task_count=$(printf '%s' "$include_tasks" | wc -w | tr -d ' ') - if [ "$task_count" -ne 30 ]; then - echo "::error::tau3-subset resolved to $task_count tasks (expected 30); refusing to run a mismatched task set." - exit 1 + if [ -n "$HARBOR_INCLUDE_TASKS" ]; then + # A caller-provided filter (e.g. profile=lite) wins: keep it, skip the + # full tau3_subset expansion and its 30-task invariant. Still rewrite + # the dataset ref + LangSmith name below. + include_tasks="$HARBOR_INCLUDE_TASKS" + echo "tau3-subset: using caller include_tasks ($(printf '%s' "$include_tasks" | wc -w | tr -d ' ') tasks)" + else + include_tasks="$(uv run python -c 'from deepagents_evals.tau3_subset import INCLUDE_TASKS; print(INCLUDE_TASKS)')" + # Fail loudly if the filter resolved to the wrong size. An import error + # already aborts via `set -e` (a bare assignment propagates the command + # substitution's exit code — do not switch to `local`/`export`, which + # swallow it), but a successful-but-empty/partial result would be + # written verbatim and silently run a different set than the promised + # "30-task subset" — an empty value means NO filter, i.e. the FULL + # dataset, still mislabeled as tau3-subset in LangSmith. 30 is the same + # invariant the unit tests pin; change both together. + task_count=$(printf '%s' "$include_tasks" | wc -w | tr -d ' ') + if [ "$task_count" -ne 30 ]; then + echo "::error::tau3-subset resolved to $task_count tasks (expected 30); refusing to run a mismatched task set." + exit 1 + fi + echo "tau3-subset -> sierra-research/tau3-bench, $task_count tasks" fi { echo "HARBOR_DATASET=sierra-research/tau3-bench" echo "HARBOR_INCLUDE_TASKS=$include_tasks" echo "HARBOR_LANGSMITH_DATASET_NAME=tau3-subset" } >> "$GITHUB_ENV" - echo "tau3-subset -> sierra-research/tau3-bench, $task_count tasks" - name: "✂️ Prune agent provider deps to selected model" # The agent loads its model via init_chat_model, which lazily imports diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index cba82db3f81..b4d707b8b54 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -18,6 +18,13 @@ on: options: - dcode - bare + profile: + description: "Task scope: 'full' (every task) or 'lite' (frozen high-signal subset from lite_tasks.py — fewer tasks, full rollouts)." + type: choice + default: "full" + options: + - full + - lite rollouts: type: string default: "3" @@ -99,6 +106,7 @@ jobs: UNIFIED_MODELS: ${{ inputs.models }} UNIFIED_CATEGORIES: ${{ inputs.categories }} UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} + UNIFIED_PROFILE: ${{ inputs.profile }} UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} UNIFIED_SHARD_PARALLEL: ${{ inputs.shard_parallel }} UNIFIED_N_SHARDS_AUTONOMOUS: ${{ inputs.n_shards_autonomous }} @@ -129,6 +137,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-baseten: needs: prep @@ -153,6 +162,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-fireworks: needs: prep @@ -177,6 +187,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-google_genai: needs: prep @@ -201,6 +212,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-groq: needs: prep @@ -225,6 +237,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-nvidia: needs: prep @@ -249,6 +262,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-ollama: needs: prep @@ -273,6 +287,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-openai: needs: prep @@ -297,6 +312,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-openrouter: needs: prep @@ -321,6 +337,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-xai: needs: prep @@ -345,6 +362,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} eval-other: needs: prep @@ -369,6 +387,7 @@ jobs: sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} + include_tasks: ${{ matrix.include_tasks }} combine: name: "📊 Combine cross-model results" From 9346afa27f50434edd9287a6eda42d094070d725 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 22:54:51 -0400 Subject: [PATCH 11/48] ci(evals): drop heavy bixbench tasks from lite autonomous subset The two bix* tasks pull the ~6 GB chenzizhao/bixbench image, which exhausts the Docker-sandbox runner disk when co-scheduled in one shard (and fails the LangSmith builder). Replace with light python-slim tasks (build-word2vec-pipeline, arcagi2-grid-transform-8b7b) to keep the frontier size at 15 without the disk blowout. --- .github/scripts/lite_tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/scripts/lite_tasks.py b/.github/scripts/lite_tasks.py index e72b8b50664..e6ce3debb0f 100644 --- a/.github/scripts/lite_tasks.py +++ b/.github/scripts/lite_tasks.py @@ -17,16 +17,19 @@ LITE_TASKS: dict[str, list[str]] = { # 15 — luna is weak here, so a rich frontier: partials + hard-but-solvable. + # Excludes the bix* bioinformatics tasks: their ~6 GB `chenzizhao/bixbench` + # image exhausts the Docker-sandbox runner disk (and fails the LangSmith + # builder). Re-add once lite runs on a sandbox that builds big images. "autonomous": [ "harbor-index/replicationbench-find-galactic-vz-peaks", "harbor-index/swebenchverified-fix-span-selector-axes-limits", "harbor-index/omnimath-find-perfect-square-functions", "harbor-index/usaco-assign-cows-to-barns", "harbor-index/featurebench-add-feature-mlflow-bedrock-autolog", - "harbor-index/bix-filter-chip-variants", + "harbor-index/build-word2vec-pipeline", "harbor-index/tb-dna-insert", "harbor-index/swebenchverified-fix-django-mti-parent-link", - "harbor-index/bix-ordinal-logit-covid", + "harbor-index/arcagi2-grid-transform-8b7b", "harbor-index/labbench-habenula-fluorescence-change", "harbor-index/labbench-read-asap2f-step-response", "harbor-index/gso-speedup-pydantic-enum", From 8b7a6e8fc2ed848ac09fb505ace0aacbe3f1e292 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 23:48:25 -0400 Subject: [PATCH 12/48] ci(evals): max lite concurrency by fanning shards to ~2 tasks each The lite profile was right-sizing shards to ~5 tasks each (min(default, ceil(n/5))), so a 15-task autonomous slice ran only 3 shards => 12 concurrent trials of a 40/model budget (~30% utilization). Fan out to ~2 tasks/shard capped at shard_parallel so every shard runs at once: autonomous 3->8 shards (32 concurrent), conversation 3->6, context 2->4. Also scatters heavy task images one-per-runner instead of concentrating them in a fat shard. --- .github/scripts/test_unified_prep.py | 21 +++++++++++++++++++-- .github/scripts/unified_prep.py | 10 +++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 0f908de3d9b..1480c518e74 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -109,7 +109,7 @@ def test_full_profile_has_empty_include_tasks(): assert mats["openai"][0]["include_tasks"] == "" -def test_lite_profile_sets_include_tasks_and_right_sizes_shards(): +def test_lite_profile_sets_include_tasks_and_maxes_shards(): import lite_tasks defaults = {"autonomous": 10, "conversation": 3, "context": 3} @@ -125,7 +125,24 @@ def test_lite_profile_sets_include_tasks_and_right_sizes_shards(): for cat in ("autonomous", "conversation", "context"): n = len(lite_tasks.LITE_TASKS[cat]) assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) - assert by_cat[cat]["n_shards"] == min(defaults[cat], max(1, (n + 4) // 5)) + # ~2 tasks/shard, capped at shard_parallel so every shard runs at once + # (ignores the full-run per-category default, which is irrelevant to lite). + assert by_cat[cat]["n_shards"] == min(10, max(1, (n + 1) // 2)) + # A 15-task autonomous slice fans out to 8 shards, not the old 3. + assert by_cat["autonomous"]["n_shards"] == 8 + + +def test_lite_shards_capped_by_shard_parallel(): + # When shard_parallel is small, lite must not create more shards than can run + # concurrently (queued shards just idle behind the serialized category). + mats = up.build_provider_matrices( + ["openai:gpt"], + ["autonomous"], + shard_parallel=2, + n_shards_by_cat={"autonomous": 10}, + profile="lite", + ) + assert mats["openai"][0]["n_shards"] == 2 def test_main_rejects_invalid_profile(tmp_path, monkeypatch): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index de6848660bc..f30fd774a8c 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -129,13 +129,17 @@ def build_provider_matrices( # `dcode_impl` swaps the harness for the code categories only; the # conversation category's tau3 harness is left untouched. agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] - # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks); - # right-size shards so a ~15-task slice doesn't spin 10 runners. + # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks). + # Spread ~2 tasks per shard, capped at shard_parallel so every shard + # runs at once: this maxes concurrency (categories are serialized per + # provider, so a category never exceeds shard_parallel*concurrency + # trials in flight) and scatters heavy task images one-per-runner + # instead of concentrating them in a fat shard. include = lite_tasks.include_tasks(cat) if profile == "lite" else "" n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) if include: n_tasks = len(include.split()) - n_shards = min(n_shards, max(1, (n_tasks + 4) // 5)) + n_shards = min(shard_parallel, max(1, (n_tasks + 1) // 2)) entry = { "model": spec, "provider": prov, From ca040c0e9059014ddaedfc8d5c262d5fd845da94 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Mon, 13 Jul 2026 23:56:21 -0400 Subject: [PATCH 13/48] ci(evals): shard lite one task per shard for dynamic dispatch Cap-at-shard_parallel meant n_shards never exceeded max-parallel, so there was no queue: all shards started at once with a static task partition, and a runner that drew fast tasks went idle while the long-pole shard ran. Set n_shards = n_tasks so shard_parallel is purely the concurrent-slot count and GitHub's matrix scheduler pulls the next single-task shard the instant one finishes. The long pole becomes the slowest single task, and each runner builds exactly one task image (no heavy-image concentration). --- .github/scripts/test_unified_prep.py | 19 +++++++++---------- .github/scripts/unified_prep.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 1480c518e74..59156f4835c 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -109,7 +109,7 @@ def test_full_profile_has_empty_include_tasks(): assert mats["openai"][0]["include_tasks"] == "" -def test_lite_profile_sets_include_tasks_and_maxes_shards(): +def test_lite_profile_sets_include_tasks_and_shards_one_task_each(): import lite_tasks defaults = {"autonomous": 10, "conversation": 3, "context": 3} @@ -125,16 +125,15 @@ def test_lite_profile_sets_include_tasks_and_maxes_shards(): for cat in ("autonomous", "conversation", "context"): n = len(lite_tasks.LITE_TASKS[cat]) assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) - # ~2 tasks/shard, capped at shard_parallel so every shard runs at once - # (ignores the full-run per-category default, which is irrelevant to lite). - assert by_cat[cat]["n_shards"] == min(10, max(1, (n + 1) // 2)) - # A 15-task autonomous slice fans out to 8 shards, not the old 3. - assert by_cat["autonomous"]["n_shards"] == 8 + # One task per shard: max-parallel drains the queue, GH pulls the next + # single-task shard as each finishes (dynamic load-balancing). + assert by_cat[cat]["n_shards"] == n + assert by_cat["autonomous"]["n_shards"] == 15 -def test_lite_shards_capped_by_shard_parallel(): - # When shard_parallel is small, lite must not create more shards than can run - # concurrently (queued shards just idle behind the serialized category). +def test_lite_shards_independent_of_shard_parallel(): + # n_shards is the queue depth (one task each), NOT capped at shard_parallel: + # a small max-parallel just means GH drains the queue in more waves. mats = up.build_provider_matrices( ["openai:gpt"], ["autonomous"], @@ -142,7 +141,7 @@ def test_lite_shards_capped_by_shard_parallel(): n_shards_by_cat={"autonomous": 10}, profile="lite", ) - assert mats["openai"][0]["n_shards"] == 2 + assert mats["openai"][0]["n_shards"] == 15 def test_main_rejects_invalid_profile(tmp_path, monkeypatch): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index f30fd774a8c..6284c4ac07e 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -130,16 +130,18 @@ def build_provider_matrices( # conversation category's tau3 harness is left untouched. agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks). - # Spread ~2 tasks per shard, capped at shard_parallel so every shard - # runs at once: this maxes concurrency (categories are serialized per - # provider, so a category never exceeds shard_parallel*concurrency - # trials in flight) and scatters heavy task images one-per-runner - # instead of concentrating them in a fat shard. + # One task per shard: `shard_parallel` (the leaf's matrix max-parallel) + # is the number of concurrent runner slots, and GitHub pulls the next + # single-task shard in the instant one finishes. That gives dynamic + # load-balancing across runners -- the long pole is the slowest single + # task, not a static bucket -- and scatters each task's image onto its + # own runner so heavy images never concentrate and blow the disk. + # Bounded by shard_matrix.MAX_SHARDS (and its 256-job matrix guard). include = lite_tasks.include_tasks(cat) if profile == "lite" else "" n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) if include: n_tasks = len(include.split()) - n_shards = min(shard_parallel, max(1, (n_tasks + 1) // 2)) + n_shards = min(n_tasks, shard_matrix.MAX_SHARDS) entry = { "model": spec, "provider": prov, From 7f6abae4f2dd0c91074501da6bf8ab6da9d7d269 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 00:13:37 -0400 Subject: [PATCH 14/48] ci(evals): size lite shards to saturate --concurrency (rollout-aware) One-task-per-shard left --concurrency idle: a shard ran only its `rollouts` trials (3 of 4). Size each shard to ceil(concurrency/rollouts) tasks so its tasks*rollouts trial count fills concurrency and every active runner runs a full 4-wide. Rollout-aware: rollouts=1 -> 4 tasks/shard instead of wasting slots. Threads concurrency+rollouts through prep (new UNIFIED_ROLLOUTS env). Full-profile sharding is unchanged. --- .github/scripts/test_unified_prep.py | 24 +++++++++++-------- .github/scripts/unified_prep.py | 35 +++++++++++++++++++++------- .github/workflows/unified_evals.yml | 1 + 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 59156f4835c..a33f2fab7c0 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -109,7 +109,7 @@ def test_full_profile_has_empty_include_tasks(): assert mats["openai"][0]["include_tasks"] == "" -def test_lite_profile_sets_include_tasks_and_shards_one_task_each(): +def test_lite_profile_sizes_shards_to_saturate_concurrency(): import lite_tasks defaults = {"autonomous": 10, "conversation": 3, "context": 3} @@ -120,28 +120,32 @@ def test_lite_profile_sets_include_tasks_and_shards_one_task_each(): n_shards_by_cat=defaults, dcode_impl="bare", profile="lite", + concurrency=4, + rollouts=3, ) by_cat = {e["category"]: e for e in mats["openai"]} + # ceil(4/3) = 2 tasks/shard so each shard's 2*3=6 trials cover concurrency 4. for cat in ("autonomous", "conversation", "context"): n = len(lite_tasks.LITE_TASKS[cat]) assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) - # One task per shard: max-parallel drains the queue, GH pulls the next - # single-task shard as each finishes (dynamic load-balancing). - assert by_cat[cat]["n_shards"] == n - assert by_cat["autonomous"]["n_shards"] == 15 + assert by_cat[cat]["n_shards"] == -(-n // 2) + assert by_cat["autonomous"]["n_shards"] == 8 # ceil(15/2) -def test_lite_shards_independent_of_shard_parallel(): - # n_shards is the queue depth (one task each), NOT capped at shard_parallel: - # a small max-parallel just means GH drains the queue in more waves. +def test_lite_shard_sizing_is_rollout_aware(): + # rollouts=1 -> a shard needs `concurrency` tasks to fill concurrency, so + # shards get fatter (4 tasks each here) instead of wasting slots. mats = up.build_provider_matrices( ["openai:gpt"], ["autonomous"], - shard_parallel=2, + shard_parallel=10, n_shards_by_cat={"autonomous": 10}, profile="lite", + concurrency=4, + rollouts=1, ) - assert mats["openai"][0]["n_shards"] == 15 + # ceil(4/1) = 4 tasks/shard -> ceil(15/4) = 4 shards. + assert mats["openai"][0]["n_shards"] == 4 def test_main_rejects_invalid_profile(tmp_path, monkeypatch): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 6284c4ac07e..e91ec022d2c 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -120,6 +120,8 @@ def build_provider_matrices( n_shards_by_cat: dict[str, int], dcode_impl: str = "dcode", profile: str = "full", + concurrency: int = 4, + rollouts: int = 3, ) -> dict[str, list[dict]]: matrices: dict[str, list[dict]] = {} for spec in models_list: @@ -130,18 +132,21 @@ def build_provider_matrices( # conversation category's tau3 harness is left untouched. agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks). - # One task per shard: `shard_parallel` (the leaf's matrix max-parallel) - # is the number of concurrent runner slots, and GitHub pulls the next - # single-task shard in the instant one finishes. That gives dynamic - # load-balancing across runners -- the long pole is the slowest single - # task, not a static bucket -- and scatters each task's image onto its - # own runner so heavy images never concentrate and blow the disk. - # Bounded by shard_matrix.MAX_SHARDS (and its 256-job matrix guard). + # Size shards to saturate a runner's `--concurrency`: give each shard + # `ceil(concurrency / rollouts)` tasks so its trial count + # (tasks * rollouts) is at least `concurrency` and no slot sits idle. + # This is rollout-aware -- fewer rollouts pack more tasks per shard -- + # and when the task list is large the resulting shard count exceeds + # shard_parallel, forming a queue GitHub drains dynamically. Bounded by + # shard_matrix.MAX_SHARDS (and its 256-job matrix guard). include = lite_tasks.include_tasks(cat) if profile == "lite" else "" n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) if include: n_tasks = len(include.split()) - n_shards = min(n_tasks, shard_matrix.MAX_SHARDS) + tasks_per_shard = max(1, -(-concurrency // max(rollouts, 1))) + n_shards = min( + -(-n_tasks // tasks_per_shard), shard_matrix.MAX_SHARDS + ) entry = { "model": spec, "provider": prov, @@ -193,6 +198,11 @@ def main(argv: list[str] | None = None) -> int: minimum=1, maximum=MAX_TASKS_PER_MODEL, ) + rollouts = parse_int_input( + "UNIFIED_ROLLOUTS", + os.environ.get("UNIFIED_ROLLOUTS", "3"), + minimum=1, + ) requested_sp = parse_int_input( "UNIFIED_SHARD_PARALLEL", os.environ.get("UNIFIED_SHARD_PARALLEL", "10"), @@ -251,7 +261,14 @@ def main(argv: list[str] | None = None) -> int: assert len(providers_present) * shard_parallel <= MAX_RUNNERS matrices = build_provider_matrices( - model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl, profile + model_specs, + categories, + shard_parallel, + n_shards_by_cat, + dcode_impl, + profile, + concurrency, + rollouts, ) outputs: dict[str, object] = { diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index b4d707b8b54..c69102a19d7 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -108,6 +108,7 @@ jobs: UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} UNIFIED_PROFILE: ${{ inputs.profile }} UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} + UNIFIED_ROLLOUTS: ${{ inputs.rollouts }} UNIFIED_SHARD_PARALLEL: ${{ inputs.shard_parallel }} UNIFIED_N_SHARDS_AUTONOMOUS: ${{ inputs.n_shards_autonomous }} UNIFIED_N_SHARDS_CONVERSATION: ${{ inputs.n_shards_conversation }} From ac07bc90427962aec266744ff879aecdc6d08395 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 09:09:24 -0400 Subject: [PATCH 15/48] Revert "ci(evals): size lite shards to saturate --concurrency (rollout-aware)" This reverts commit 7f6abae4f2dd0c91074501da6bf8ab6da9d7d269. --- .github/scripts/test_unified_prep.py | 24 ++++++++----------- .github/scripts/unified_prep.py | 35 +++++++--------------------- .github/workflows/unified_evals.yml | 1 - 3 files changed, 19 insertions(+), 41 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index a33f2fab7c0..59156f4835c 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -109,7 +109,7 @@ def test_full_profile_has_empty_include_tasks(): assert mats["openai"][0]["include_tasks"] == "" -def test_lite_profile_sizes_shards_to_saturate_concurrency(): +def test_lite_profile_sets_include_tasks_and_shards_one_task_each(): import lite_tasks defaults = {"autonomous": 10, "conversation": 3, "context": 3} @@ -120,32 +120,28 @@ def test_lite_profile_sizes_shards_to_saturate_concurrency(): n_shards_by_cat=defaults, dcode_impl="bare", profile="lite", - concurrency=4, - rollouts=3, ) by_cat = {e["category"]: e for e in mats["openai"]} - # ceil(4/3) = 2 tasks/shard so each shard's 2*3=6 trials cover concurrency 4. for cat in ("autonomous", "conversation", "context"): n = len(lite_tasks.LITE_TASKS[cat]) assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) - assert by_cat[cat]["n_shards"] == -(-n // 2) - assert by_cat["autonomous"]["n_shards"] == 8 # ceil(15/2) + # One task per shard: max-parallel drains the queue, GH pulls the next + # single-task shard as each finishes (dynamic load-balancing). + assert by_cat[cat]["n_shards"] == n + assert by_cat["autonomous"]["n_shards"] == 15 -def test_lite_shard_sizing_is_rollout_aware(): - # rollouts=1 -> a shard needs `concurrency` tasks to fill concurrency, so - # shards get fatter (4 tasks each here) instead of wasting slots. +def test_lite_shards_independent_of_shard_parallel(): + # n_shards is the queue depth (one task each), NOT capped at shard_parallel: + # a small max-parallel just means GH drains the queue in more waves. mats = up.build_provider_matrices( ["openai:gpt"], ["autonomous"], - shard_parallel=10, + shard_parallel=2, n_shards_by_cat={"autonomous": 10}, profile="lite", - concurrency=4, - rollouts=1, ) - # ceil(4/1) = 4 tasks/shard -> ceil(15/4) = 4 shards. - assert mats["openai"][0]["n_shards"] == 4 + assert mats["openai"][0]["n_shards"] == 15 def test_main_rejects_invalid_profile(tmp_path, monkeypatch): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index e91ec022d2c..6284c4ac07e 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -120,8 +120,6 @@ def build_provider_matrices( n_shards_by_cat: dict[str, int], dcode_impl: str = "dcode", profile: str = "full", - concurrency: int = 4, - rollouts: int = 3, ) -> dict[str, list[dict]]: matrices: dict[str, list[dict]] = {} for spec in models_list: @@ -132,21 +130,18 @@ def build_provider_matrices( # conversation category's tau3 harness is left untouched. agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks). - # Size shards to saturate a runner's `--concurrency`: give each shard - # `ceil(concurrency / rollouts)` tasks so its trial count - # (tasks * rollouts) is at least `concurrency` and no slot sits idle. - # This is rollout-aware -- fewer rollouts pack more tasks per shard -- - # and when the task list is large the resulting shard count exceeds - # shard_parallel, forming a queue GitHub drains dynamically. Bounded by - # shard_matrix.MAX_SHARDS (and its 256-job matrix guard). + # One task per shard: `shard_parallel` (the leaf's matrix max-parallel) + # is the number of concurrent runner slots, and GitHub pulls the next + # single-task shard in the instant one finishes. That gives dynamic + # load-balancing across runners -- the long pole is the slowest single + # task, not a static bucket -- and scatters each task's image onto its + # own runner so heavy images never concentrate and blow the disk. + # Bounded by shard_matrix.MAX_SHARDS (and its 256-job matrix guard). include = lite_tasks.include_tasks(cat) if profile == "lite" else "" n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) if include: n_tasks = len(include.split()) - tasks_per_shard = max(1, -(-concurrency // max(rollouts, 1))) - n_shards = min( - -(-n_tasks // tasks_per_shard), shard_matrix.MAX_SHARDS - ) + n_shards = min(n_tasks, shard_matrix.MAX_SHARDS) entry = { "model": spec, "provider": prov, @@ -198,11 +193,6 @@ def main(argv: list[str] | None = None) -> int: minimum=1, maximum=MAX_TASKS_PER_MODEL, ) - rollouts = parse_int_input( - "UNIFIED_ROLLOUTS", - os.environ.get("UNIFIED_ROLLOUTS", "3"), - minimum=1, - ) requested_sp = parse_int_input( "UNIFIED_SHARD_PARALLEL", os.environ.get("UNIFIED_SHARD_PARALLEL", "10"), @@ -261,14 +251,7 @@ def main(argv: list[str] | None = None) -> int: assert len(providers_present) * shard_parallel <= MAX_RUNNERS matrices = build_provider_matrices( - model_specs, - categories, - shard_parallel, - n_shards_by_cat, - dcode_impl, - profile, - concurrency, - rollouts, + model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl, profile ) outputs: dict[str, object] = { diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index c69102a19d7..b4d707b8b54 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -108,7 +108,6 @@ jobs: UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} UNIFIED_PROFILE: ${{ inputs.profile }} UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} - UNIFIED_ROLLOUTS: ${{ inputs.rollouts }} UNIFIED_SHARD_PARALLEL: ${{ inputs.shard_parallel }} UNIFIED_N_SHARDS_AUTONOMOUS: ${{ inputs.n_shards_autonomous }} UNIFIED_N_SHARDS_CONVERSATION: ${{ inputs.n_shards_conversation }} From 1d877550afe833e433531d65ebe7bdbc09c0ee3e Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 09:24:54 -0400 Subject: [PATCH 16/48] docs(evals): add unified scorecard with full and lite for luna --- libs/evals/UNIFIED_SCORECARD.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 libs/evals/UNIFIED_SCORECARD.md diff --git a/libs/evals/UNIFIED_SCORECARD.md b/libs/evals/UNIFIED_SCORECARD.md new file mode 100644 index 00000000000..aa269f599af --- /dev/null +++ b/libs/evals/UNIFIED_SCORECARD.md @@ -0,0 +1,31 @@ +# Model Scorecard — Unified Evals + +GH aggregate pass@k / avg@k from `.github/workflows/unified_evals.yml`. pass@k = fraction of tasks solved in ≥1 of k rollouts; avg@k = mean reward across rollouts; rewards are binary (0/1). + +## openai:gpt-5.6-luna + +### Full (default) + +| Category | pass@k | avg@k | tasks | +| --- | --- | --- | --- | +| autonomous (harbor-index) | 0.159 | 0.114 | 82 | +| conversation (tau3-subset) | 0.367 | 0.322 | 30 | +| context (context-retrieval) | 0.733 | 0.411 | 30 | +| **macro** | **0.420** | **0.282** | | +| **micro** | **0.324** | **0.221** | | + +Run [29272737912](https://github.com/langchain-ai/deepagents/actions/runs/29272737912) · 2026-07-13 · `agent_impl=bare` · `profile=full` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`af2e862` + +### Lite + +Frozen high-signal subset (`lite_tasks.py`, difficulty-frontier tasks). + +| Category | pass@k | avg@k | tasks | +| --- | --- | --- | --- | +| autonomous (harbor-index) | 0.400 | 0.156 | 15 | +| conversation (tau3-subset) | 0.273 | 0.212 | 11 | +| context (context-retrieval) | 0.375 | 0.125 | 8 | +| **macro** | **0.349** | **0.164** | | +| **micro** | **0.353** | **0.167** | | + +Run [29304843581](https://github.com/langchain-ai/deepagents/actions/runs/29304843581) · 2026-07-14 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`af2e862` \ No newline at end of file From 26cb12a48c79565b60b982cdc1c52bab41735933 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 09:33:36 -0400 Subject: [PATCH 17/48] ci(evals): fix evals lint formatting and sync harbor override doc ruff-format two evals files (hand-wrapped lines the repo's ruff collapses), and mirror the multi-spec harbor_package_override description into harbor.yml so the both-surfaces consistency test passes. --- .github/workflows/harbor.yml | 2 +- libs/evals/deepagents_harbor/langsmith.py | 5 +---- .../tests/unit_tests/test_harbor_langgraph_agent.py | 12 +++--------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 5cbcf1cec69..6fc53b4dc68 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -189,7 +189,7 @@ on: default: "10" type: string harbor_package_override: - description: "Optional: install Harbor from an arbitrary package spec instead of the locked version, to test an unreleased Harbor build. Use a trusted package source. Prefer an immutable commit SHA, and never embed credentials in the package spec. Leave empty to use the pinned Harbor." + description: "Optional: install Harbor from an arbitrary package spec instead of the locked version, to test an unreleased Harbor build. One spec per line — e.g. `harbor @ git+…@` on the first line and `harbor-langsmith @ git+…@#subdirectory=packages/harbor-langsmith` on the second. Use a trusted package source. Prefer an immutable commit SHA, and never embed credentials in the package spec. Leave empty to use the pinned Harbor." required: false default: "" type: string diff --git a/libs/evals/deepagents_harbor/langsmith.py b/libs/evals/deepagents_harbor/langsmith.py index 28150302b92..96ab8101c49 100644 --- a/libs/evals/deepagents_harbor/langsmith.py +++ b/libs/evals/deepagents_harbor/langsmith.py @@ -106,10 +106,7 @@ def _headers() -> dict[str, str]: """ result = resolve_langsmith_api_key() if not result: - msg = ( - "No LangSmith API key found. Set one of: " - "LANGSMITH_API_KEY, LANGCHAIN_API_KEY." - ) + msg = "No LangSmith API key found. Set one of: LANGSMITH_API_KEY, LANGCHAIN_API_KEY." raise ValueError(msg) return {"x-api-key": result[0]} diff --git a/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py b/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py index 797ef3abbbd..de3a08b707b 100644 --- a/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py +++ b/libs/evals/tests/unit_tests/test_harbor_langgraph_agent.py @@ -150,9 +150,7 @@ def fake_init_chat_model(model: str, **kwargs: object) -> object: return "chat-model" monkeypatch.setattr(langgraph_agent, "init_chat_model", fake_init_chat_model) - monkeypatch.setattr( - langgraph_agent, "create_cli_agent", lambda **_kwargs: (object(), object()) - ) + monkeypatch.setattr(langgraph_agent, "create_cli_agent", lambda **_kwargs: (object(), object())) langgraph_agent.make_graph( {"configurable": {"model": "openai:gpt-5.6-luna", "cwd": str(tmp_path)}} @@ -171,18 +169,14 @@ def test_build_model_respects_explicit_use_responses_api( monkeypatch.setattr( langgraph_agent, "init_chat_model", - lambda model, **kwargs: captured_init.append( - {"model": model, "kwargs": kwargs} - ), + lambda model, **kwargs: captured_init.append({"model": model, "kwargs": kwargs}), ) langgraph_agent._build_model( {"model": "openai:gpt-5", "model_kwargs": {"use_responses_api": False}} ) - assert captured_init == [ - {"model": "openai:gpt-5", "kwargs": {"use_responses_api": False}} - ] + assert captured_init == [{"model": "openai:gpt-5", "kwargs": {"use_responses_api": False}}] def test_make_bare_graph_builds_sdk_deepagent_with_local_shell( From 1f4a733e658cdea254e570de9caeb9c1ab4a7004 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 09:37:17 -0400 Subject: [PATCH 18/48] fix(evals): annotate _build_model return type for ty _build_model had no return annotation, so ty inferred object and rejected it at the create_cli_agent / create_deep_agent call sites (which want str | BaseChatModel[ | None]). Annotate the return as BaseChatModel (what init_chat_model returns); TYPE_CHECKING-only import, no runtime change. --- .../deepagents_harbor/langgraph_project/langgraph_agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py b/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py index 1eef4faa7d0..60d910c67b0 100644 --- a/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py +++ b/libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py @@ -17,6 +17,8 @@ if TYPE_CHECKING: from collections.abc import Iterator + from langchain_core.language_models import BaseChatModel + _DEFAULT_WORKDIR = Path("/app") _SHELL_ENV_DENYLIST = frozenset( @@ -100,7 +102,7 @@ def _model_name(configurable: dict[str, object]) -> str: return value -def _build_model(configurable: dict[str, object]) -> object: +def _build_model(configurable: dict[str, object]) -> BaseChatModel: """Build the chat model, defaulting OpenAI to the Responses API. OpenAI gates ``reasoning_effort`` + function tools to ``/v1/responses`` for From 37ce2b83534c8d1faebefa0b5101b1aa01fc86fb Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 09:46:41 -0400 Subject: [PATCH 19/48] docs(evals): note harbor override needed for one-experiment-per-model Released harbor-langsmith==0.1.1 suffixes every shard's LangSmith experiment with -{job.id[:8]}, so a model fragments into one experiment per shard on the shared dataset. harbor main honors the explicit experiment_name the leaf sets and reuses the session across shards; document that the harbor_package_override (commit af2e862) is required until that ships in a release. --- .github/scripts/unified_prep.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 6284c4ac07e..409e9abf9cb 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -151,9 +151,18 @@ def build_provider_matrices( "agent_impl": agent_impl, "include_tasks": include, # Empty: the leaf derives the canonical shared dataset name per - # category (harbor-index/harbor-index-1.0, tau3-subset, - # local/...), so every model attaches as an experiment on the one - # shared dataset. unified_summary remains the cross-model surface. + # category (harbor-index/harbor-index-1.0, tau3-subset, local/...) + # and a stable per-run experiment name, so a model's shards attach + # to the one shared dataset. NOTE: consolidating those shards into a + # SINGLE experiment per model needs harbor > 0.1.1. Released + # harbor-langsmith==0.1.1 suffixes every shard's experiment with + # "-{job.id[:8]}" (one experiment per shard); harbor main honors the + # explicit experiment_name _harbor_run.yml sets and reuses the + # session across shards. Until a fixed release ships, set the + # `harbor_package_override` input to a harbor build with that fix, + # e.g. commit af2e8629e95c2e9f487f7a2ba87c1e25b531a55b (see that + # input's description for the full pip specs). The GH-aggregated + # unified_summary is the cross-model surface regardless. "langsmith_dataset": "", "n_shards": n_shards, "shard_parallel": shard_parallel, From cd446817983bc63f178275588689358e5cc70e8e Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 14:44:38 -0400 Subject: [PATCH 20/48] feat(evals): raise shard MAX_SHARDS to 200 guard under GH 256 cap --- .github/scripts/shard_matrix.py | 8 +++++--- .github/scripts/test_shard_matrix.py | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/scripts/shard_matrix.py b/.github/scripts/shard_matrix.py index 295a093ae2a..9e1a3dfc338 100644 --- a/.github/scripts/shard_matrix.py +++ b/.github/scripts/shard_matrix.py @@ -33,9 +33,11 @@ # https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs GITHUB_MATRIX_MAX = 256 -# Upper bound on the shard axis itself, independent of the matrix cap. Keeps a -# fat-fingered dispatch (e.g. n_shards=1000) from producing a nonsensical run. -MAX_SHARDS = 64 +# Upper bound on the shard axis itself, independent of the matrix cap. Set below +# GitHub's hard GITHUB_MATRIX_MAX so an oversized pool trips this clear error +# rather than GitHub's opaque one; pools larger than this pack multiple tasks +# per shard (see pack_tasks) instead of failing. +MAX_SHARDS = 200 class ShardConfigError(Exception): diff --git a/.github/scripts/test_shard_matrix.py b/.github/scripts/test_shard_matrix.py index f34cf4279bd..a9f61989216 100644 --- a/.github/scripts/test_shard_matrix.py +++ b/.github/scripts/test_shard_matrix.py @@ -87,9 +87,23 @@ def test_expand_matrix_rejects_real_all_set_overflow(shard: ModuleType) -> None: shard.expand_matrix(_models(56), 5) -@pytest.mark.parametrize("bad", [0, 65, -1]) +def test_expand_matrix_accepts_max_shards_boundary(shard: ModuleType) -> None: + """n_shards == MAX_SHARDS is accepted (boundary).""" + m = {"include": [{"model": "x"}]} + out = shard.expand_matrix(m, shard.MAX_SHARDS) + assert len(out["include"]) == shard.MAX_SHARDS + + +def test_expand_matrix_rejects_over_max_shards(shard: ModuleType) -> None: + """n_shards == MAX_SHARDS + 1 is rejected (out of range).""" + m = {"include": [{"model": "x"}]} + with pytest.raises(shard.ShardConfigError, match=r"1\.\.200"): + shard.expand_matrix(m, shard.MAX_SHARDS + 1) + + +@pytest.mark.parametrize("bad", [0, 201, -1]) def test_expand_matrix_rejects_out_of_range_shards(shard: ModuleType, bad: int) -> None: - """n_shards must be an integer in 1..64.""" + """n_shards must be an integer in 1..200.""" with pytest.raises(shard.ShardConfigError, match="Invalid n_shards"): shard.expand_matrix(_models(2), bad) From 08c06409a8188e0fb37d980b0550ab5b6e75287c Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 14:47:41 -0400 Subject: [PATCH 21/48] feat(evals): add pack_tasks for graceful shard packing above cap --- .github/scripts/shard_matrix.py | 15 ++++++++++++ .github/scripts/test_shard_matrix.py | 34 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/.github/scripts/shard_matrix.py b/.github/scripts/shard_matrix.py index 9e1a3dfc338..f65d4071ee9 100644 --- a/.github/scripts/shard_matrix.py +++ b/.github/scripts/shard_matrix.py @@ -186,6 +186,21 @@ def select_shard_tasks( return [name for j, name in enumerate(selected) if j % n_shards == shard_index] +def pack_tasks(names: list[str], max_shards: int = MAX_SHARDS) -> list[list[str]]: + """Split an ordered task list into at most ``max_shards`` contiguous groups. + + One task per group when ``len(names) <= max_shards`` (the common 1-task-shard + case). Above the cap, each group holds ``ceil(n / max_shards)`` tasks so the + shard count stays legal; groups are contiguous slices of the input order, so + their union is exactly ``names`` with no reordering, duplication, or drops. + """ + n = len(names) + if n == 0: + return [] + per = -(-n // max_shards) # ceil division + return [names[i : i + per] for i in range(0, n, per)] + + def main() -> None: """Entry point for the prep job: expand the model matrix by shard. diff --git a/.github/scripts/test_shard_matrix.py b/.github/scripts/test_shard_matrix.py index a9f61989216..3c9b90266b0 100644 --- a/.github/scripts/test_shard_matrix.py +++ b/.github/scripts/test_shard_matrix.py @@ -441,3 +441,37 @@ def test_main_rejects_matrix_overflow_as_exit( with pytest.raises(SystemExit) as excinfo: shard.main() assert excinfo.value.code == 1 + + +# --------------------------------------------------------------------------- # +# pack_tasks — split ordered task list into contiguous groups (comment #3) +# --------------------------------------------------------------------------- # + + +def test_pack_tasks_one_per_shard_under_cap(shard: ModuleType) -> None: + """When len(names) <= max_shards, one task per group (1-task shards).""" + names = [f"t{i}" for i in range(5)] + assert shard.pack_tasks(names, max_shards=200) == [["t0"], ["t1"], ["t2"], ["t3"], ["t4"]] + + +def test_pack_tasks_packs_above_cap_contiguously(shard: ModuleType) -> None: + """Above the cap, pack ceil(n/max_shards) tasks per group contiguously. + + cap 2 -> ceil(5/2)=3 per group -> [t0,t1,t2],[t3,t4] + """ + names = [f"t{i}" for i in range(5)] + assert shard.pack_tasks(names, max_shards=2) == [["t0", "t1", "t2"], ["t3", "t4"]] + + +def test_pack_tasks_covers_every_task_disjointly(shard: ModuleType) -> None: + """Order-preserving, no dupes, no drops (covers exactly the input set).""" + names = [f"t{i}" for i in range(203)] + groups = shard.pack_tasks(names, max_shards=200) + assert len(groups) <= 200 + flat = [n for g in groups for n in g] + assert flat == names # order-preserving, no dupes, no drops + + +def test_pack_tasks_empty(shard: ModuleType) -> None: + """Empty input yields empty output.""" + assert shard.pack_tasks([], max_shards=200) == [] From f6261c225cd62378d30b7627b62a6325bb931f1a Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 14:52:49 -0400 Subject: [PATCH 22/48] feat(evals): derive max_parallel/model_parallel from concurrency+rollouts --- .github/scripts/test_unified_prep.py | 23 +++++++++++++++++------ .github/scripts/unified_prep.py | 21 +++++++++++++++++++-- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 59156f4835c..a9dff3c25c7 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -23,19 +23,30 @@ def test_provider_of_uses_prefix_and_falls_back_to_other(): def test_clamp_shard_parallel_enforces_both_invariants(): - # per-model: conc*sp<=40 ; global: P*sp<=64 + # per-model: conc*sp<=40 ; global: P*sp<=80 assert ( up.clamp_shard_parallel(10, num_providers=1, concurrency=4) == 10 - ) # 4*10=40, 1*10=64-ok + ) # 4*10=40, 1*10=80-ok assert ( - up.clamp_shard_parallel(10, num_providers=7, concurrency=4) == 9 - ) # floor(64/7)=9 + up.clamp_shard_parallel(10, num_providers=7, concurrency=4) == 10 + ) # min(10, floor(80/7)=11, floor(40/4)=10)=10 assert ( up.clamp_shard_parallel(10, num_providers=2, concurrency=8) == 5 ) # floor(40/8)=5 assert ( up.clamp_shard_parallel(10, num_providers=100, concurrency=4) == 1 - ) # floor(64/100)=0 -> 1 + ) # floor(80/100)=0 -> 1 + + +def test_derive_pool_from_concurrency_and_rollouts(): + # concurrency 4, rollouts 3 -> per_shard=3 -> 40//3=13 ; 80//13=6 + assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (13, 1) + # concurrency 1 -> per_shard=1 -> 40 ; 80//40=2 + assert up.derive_pool(concurrency=1, rollouts=3, n_shards=100, n_models=5) == (40, 2) + # rollouts < concurrency clamps per_shard to rollouts (the utilization win) + assert up.derive_pool(concurrency=4, rollouts=2, n_shards=100, n_models=1)[0] == 20 + # clamp max_parallel to n_shards when few tasks; model_parallel clamps to n_models + assert up.derive_pool(concurrency=1, rollouts=3, n_shards=8, n_models=1) == (8, 1) def test_build_provider_matrices_cross_products_models_and_categories(): @@ -236,7 +247,7 @@ def test_main_accepts_large_shard_parallel_and_clamps_to_resource_limits( "anthropic:a,baseten:b,fireworks:c,google_genai:d,groq:e," "nvidia:f,openai:g,xai:h", "1", - "8", + "10", ), ] for index, (models, concurrency, expected) in enumerate(cases): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 409e9abf9cb..5f15288a96f 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -7,7 +7,7 @@ Concurrency invariants: per model: concurrency * shard_parallel <= 40 - global: num_providers * shard_parallel <= 64 + global: num_providers * shard_parallel <= 80 """ from __future__ import annotations @@ -22,7 +22,7 @@ import shard_matrix # noqa: E402 (shard_matrix.py in same dir) MAX_TASKS_PER_MODEL = 40 -MAX_RUNNERS = 64 +MAX_RUNNERS = 80 KNOWN_PROVIDERS = { "anthropic", @@ -113,6 +113,23 @@ def clamp_shard_parallel(requested: int, num_providers: int, concurrency: int) - return max(sp, 1) +def derive_pool( + concurrency: int, rollouts: int, n_shards: int, n_models: int +) -> tuple[int, int]: + """Derive (max_parallel, model_parallel) from concurrency and rollouts. + + per_shard is the peak concurrent trials in one 1-task shard, which a shard + can never exceed: min(concurrency, rollouts). max_parallel saturates the + per-model 40-trial budget; model_parallel bounds how many models run at once + so total runners stay within MAX_RUNNERS. Both hold the invariants by + construction, so no separate clamp/assert is needed. + """ + per_shard = max(1, min(concurrency, rollouts)) + max_parallel = max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + model_parallel = max(1, min(MAX_RUNNERS // max_parallel, n_models)) + return max_parallel, model_parallel + + def build_provider_matrices( models_list: list[str], categories: list[str], From b8abc52899f11066113114edd8fb0bcb93ee88bd Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 14:56:38 -0400 Subject: [PATCH 23/48] feat(evals): add total-job guard as worker-pool escalation trigger --- .github/scripts/test_unified_prep.py | 10 ++++++++++ .github/scripts/unified_prep.py | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index a9dff3c25c7..7007eee0722 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -371,3 +371,13 @@ def test_main_routes_unknown_provider_into_other_bucket(tmp_path, monkeypatch): other = _j.loads(lines["other_matrix"]) assert [e["model"] for e in other["include"]] == ["weirdvendor:x"] assert other["include"][0]["provider"] == "other" + + +def test_total_job_guard_allows_within_budget(): + up.total_job_guard(n_models=2, est_tasks_per_model=142) # 284 <= 400, no raise + + +def test_total_job_guard_rejects_over_budget(): + import pytest + with pytest.raises(SystemExit, match=r"worker pool"): + up.total_job_guard(n_models=3, est_tasks_per_model=142) # 426 > 400 diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 5f15288a96f..d9de5f4d487 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -65,6 +65,26 @@ # high-signal subset from lite_tasks.py (fewer tasks, full rollouts). PROFILES = {"full", "lite"} +TOTAL_JOB_BUDGET = 400 + + +def total_job_guard(n_models: int, est_tasks_per_model: int) -> None: + """Fail when the flat matrix would generate too many total jobs. + + At 1-task/shard the run generates n_models * est_tasks jobs. GitHub-hosted + Actions become unreliable well before that count needs to be large, so cap + it and point at the worker-pool escalation instead of silently launching a + firehose. + """ + total = n_models * est_tasks_per_model + if total > TOTAL_JOB_BUDGET: + raise SystemExit( + f"Flat matrix would generate ~{total} jobs " + f"({n_models} models x ~{est_tasks_per_model} tasks), over " + f"TOTAL_JOB_BUDGET={TOTAL_JOB_BUDGET}. Reduce the model set or task " + "count, or move to a worker pool orchestrator (see the flat-pool spec)." + ) + def parse_int_input( name: str, From 8d990f63c9d6ec76023e1b96d8fd1d0f4414d026 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 14:59:09 -0400 Subject: [PATCH 24/48] feat(evals): build per-model flat cross-category shard matrix --- .github/scripts/test_unified_prep.py | 35 +++++++++++++++++++++++++++ .github/scripts/unified_prep.py | 36 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 7007eee0722..8937611d2c0 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -381,3 +381,38 @@ def test_total_job_guard_rejects_over_budget(): import pytest with pytest.raises(SystemExit, match=r"worker pool"): up.total_job_guard(n_models=3, est_tasks_per_model=142) # 426 > 400 + + +def test_build_flat_matrix_one_entry_per_task_across_categories(): + tasks = { + "autonomous": ["harbor-index/a", "harbor-index/b"], + "context": ["cb-cloud-0"], + } + entries = up.build_flat_matrix( + "openai:gpt", ["autonomous", "context"], tasks, dcode_impl="bare" + ) + # 2 autonomous + 1 context = 3 single-task shards + assert len(entries) == 3 + auto = [e for e in entries if e["category"] == "autonomous"] + assert {e["include_tasks"] for e in auto} == {"harbor-index/a", "harbor-index/b"} + assert all(e["n_shards"] == 1 and e["shard"] == 0 for e in entries) + assert all(e["agent_impl"] == "bare" for e in auto) # dcode override applies + ctx = next(e for e in entries if e["category"] == "context") + assert ctx["dataset_path"] == "datasets/context-retrieval-evals" + assert ctx["agent_impl"] == "bare" + assert all(e["langsmith_dataset"] == "" for e in entries) + + +def test_build_flat_matrix_conversation_stays_tau3(): + tasks = {"conversation": ["sierra-research/tau3-bench__x"]} + entries = up.build_flat_matrix("openai:gpt", ["conversation"], tasks, dcode_impl="bare") + assert entries[0]["agent_impl"] == "tau3" + + +def test_build_flat_matrix_packs_above_cap(): + tasks = {"autonomous": [f"harbor-index/t{i}" for i in range(shard_matrix.MAX_SHARDS + 5)]} + entries = up.build_flat_matrix("openai:gpt", ["autonomous"], tasks, dcode_impl="dcode") + assert len(entries) <= shard_matrix.MAX_SHARDS + # every task still present, split across include_tasks strings + seen = " ".join(e["include_tasks"] for e in entries).split() + assert seen == tasks["autonomous"] diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index d9de5f4d487..f5422569468 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -150,6 +150,42 @@ def derive_pool( return max_parallel, model_parallel +def build_flat_matrix( + model: str, + categories: list[str], + tasks_by_cat: dict[str, list[str]], + dcode_impl: str = "dcode", +) -> list[dict]: + """One flat matrix of single-`harbor run` shards spanning all categories. + + Each category's task list is packed into <= MAX_SHARDS groups (1 task each + below the cap); each group is one matrix entry carrying its own dataset and + agent so the leaf's max-parallel pool drains the mixed queue across category + boundaries. `provider` is retained only as an aggregation tag. + """ + prov = provider_of(model) + entries: list[dict] = [] + for cat in categories: + cm = CATEGORY_MAP[cat] + agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] + for group in shard_matrix.pack_tasks(tasks_by_cat.get(cat, [])): + entries.append( + { + "model": model, + "provider": prov, + "category": cat, + "dataset": cm["dataset"], + "dataset_path": cm["dataset_path"], + "agent_impl": agent_impl, + "include_tasks": " ".join(group), + "langsmith_dataset": "", + "n_shards": 1, + "shard": 0, + } + ) + return entries + + def build_provider_matrices( models_list: list[str], categories: list[str], From e9d87e3cbeae792964d1f48d1779af3ec0fc4cee Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 15:01:56 -0400 Subject: [PATCH 25/48] feat(evals): enumerate per-category task names for flat matrix --- .github/scripts/enumerate_tasks.py | 62 +++++++++++++++++++++++++ .github/scripts/test_enumerate_tasks.py | 19 ++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/scripts/enumerate_tasks.py create mode 100644 .github/scripts/test_enumerate_tasks.py diff --git a/.github/scripts/enumerate_tasks.py b/.github/scripts/enumerate_tasks.py new file mode 100644 index 00000000000..dffae2f0435 --- /dev/null +++ b/.github/scripts/enumerate_tasks.py @@ -0,0 +1,62 @@ +"""Enumerate a category's task names for the flat shard matrix. + +Reuses the exact task-name resolution the run step uses: + - local (--path) datasets: subdir basenames with a task.toml (sorted, stable), + - registry datasets: PackageDatasetClient manifest task_ids -> get_name(). + +Registry lookups need harbor installed and network; the local path is pure +stdlib. Run as a script, main() emits newline-joined names. +""" +from __future__ import annotations + +import os +import sys + +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import shard_matrix # noqa: E402 + + +def local_task_names(local_dir: str) -> list[str]: + names = sorted( + entry.name + for entry in os.scandir(local_dir) + if entry.is_dir() and os.path.isfile(os.path.join(entry.path, "task.toml")) + ) + if not names: + raise SystemExit(f"No local Harbor tasks (dirs with task.toml) under {local_dir}") + return names + + +def registry_task_names(dataset_ref: str) -> list[str]: + import asyncio + + from harbor.registry.client.package import PackageDatasetClient + + md = asyncio.run( + PackageDatasetClient().get_dataset_metadata(f"{dataset_ref}@latest") + ) + names = [x for x in (shard_matrix.task_display_name(t) for t in md.task_ids) if x] + if not names: + raise SystemExit( + f"Resolved 0 usable task names from {dataset_ref}@latest " + f"({len(md.task_ids)} task ids); unexpected task-id shape." + ) + return names + + +def main() -> int: + dataset_path = os.environ.get("ENUM_DATASET_PATH", "").strip() + dataset = os.environ.get("ENUM_DATASET", "").strip() + names = local_task_names(dataset_path) if dataset_path else registry_task_names(dataset) + out = os.environ.get("ENUM_OUTPUT") + text = "\n".join(names) + "\n" + if out: + with open(out, "w") as f: + f.write(text) + else: + sys.stdout.write(text) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/scripts/test_enumerate_tasks.py b/.github/scripts/test_enumerate_tasks.py new file mode 100644 index 00000000000..42459a2e6ee --- /dev/null +++ b/.github/scripts/test_enumerate_tasks.py @@ -0,0 +1,19 @@ +import os, sys +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import enumerate_tasks as et # noqa: E402 + + +def test_local_task_names_lists_dirs_with_task_toml(tmp_path): + (tmp_path / "cb-cloud-1").mkdir() + (tmp_path / "cb-cloud-1" / "task.toml").write_text("") + (tmp_path / "cb-cloud-0").mkdir() + (tmp_path / "cb-cloud-0" / "task.toml").write_text("") + (tmp_path / "not-a-task").mkdir() # no task.toml -> excluded + (tmp_path / "dataset.toml").write_text("") # file, not a task dir + assert et.local_task_names(str(tmp_path)) == ["cb-cloud-0", "cb-cloud-1"] + + +def test_local_task_names_empty_raises(tmp_path): + import pytest + with pytest.raises(SystemExit, match="No local Harbor tasks"): + et.local_task_names(str(tmp_path)) From d7fffdd02d7973ea2e6b8b5fdd2d0ee6766edf91 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 15:11:11 -0400 Subject: [PATCH 26/48] feat(evals): emit per-model flat matrix from unified_prep --- .github/scripts/test_unified_prep.py | 288 +++------------------------ .github/scripts/unified_prep.py | 156 ++++----------- 2 files changed, 74 insertions(+), 370 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 8937611d2c0..fa6dff6bd49 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -22,22 +22,6 @@ def test_provider_of_uses_prefix_and_falls_back_to_other(): assert up.provider_of("weirdvendor:x", known) == "other" -def test_clamp_shard_parallel_enforces_both_invariants(): - # per-model: conc*sp<=40 ; global: P*sp<=80 - assert ( - up.clamp_shard_parallel(10, num_providers=1, concurrency=4) == 10 - ) # 4*10=40, 1*10=80-ok - assert ( - up.clamp_shard_parallel(10, num_providers=7, concurrency=4) == 10 - ) # min(10, floor(80/7)=11, floor(40/4)=10)=10 - assert ( - up.clamp_shard_parallel(10, num_providers=2, concurrency=8) == 5 - ) # floor(40/8)=5 - assert ( - up.clamp_shard_parallel(10, num_providers=100, concurrency=4) == 1 - ) # floor(80/100)=0 -> 1 - - def test_derive_pool_from_concurrency_and_rollouts(): # concurrency 4, rollouts 3 -> per_shard=3 -> 40//3=13 ; 80//13=6 assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (13, 1) @@ -49,59 +33,6 @@ def test_derive_pool_from_concurrency_and_rollouts(): assert up.derive_pool(concurrency=1, rollouts=3, n_shards=8, n_models=1) == (8, 1) -def test_build_provider_matrices_cross_products_models_and_categories(): - models = ["anthropic:opus", "openai:gpt", "anthropic:sonnet"] - cats = ["autonomous", "context"] - mats = up.build_provider_matrices( - models, - cats, - shard_parallel=10, - n_shards_by_cat={"autonomous": 10, "context": 3}, - ) - # bucketed by provider prefix - assert set(mats) == {"anthropic", "openai"} - # 2 anthropic models x 2 categories = 4 entries - assert len(mats["anthropic"]) == 4 - entry = next( - e - for e in mats["anthropic"] - if e["model"] == "anthropic:opus" and e["category"] == "context" - ) - assert entry["dataset_path"] == "datasets/context-retrieval-evals" - assert entry["agent_impl"] == "dcode" - # Shared dataset: empty so the leaf derives the canonical per-category name. - assert entry["langsmith_dataset"] == "" - assert entry["n_shards"] == 3 - - -def test_dcode_impl_override_swaps_code_categories_only(): - # `dcode_impl` replaces the harness for the code categories (autonomous, - # context) but must leave the conversation category on tau3. - mats = up.build_provider_matrices( - ["openai:gpt"], - ["autonomous", "conversation", "context"], - shard_parallel=10, - n_shards_by_cat={"autonomous": 10, "conversation": 3, "context": 3}, - dcode_impl="bare", - ) - impls = {e["category"]: e["agent_impl"] for e in mats["openai"]} - assert impls == { - "autonomous": "bare", - "conversation": "tau3", - "context": "bare", - } - - -def test_dcode_impl_defaults_to_dcode(): - mats = up.build_provider_matrices( - ["openai:gpt"], - ["autonomous", "context"], - shard_parallel=10, - n_shards_by_cat={"autonomous": 10, "context": 3}, - ) - assert {e["agent_impl"] for e in mats["openai"]} == {"dcode"} - - def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): import pytest @@ -113,48 +44,6 @@ def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): up.main() -def test_full_profile_has_empty_include_tasks(): - mats = up.build_provider_matrices( - ["openai:gpt"], ["autonomous"], shard_parallel=10, n_shards_by_cat={"autonomous": 10} - ) - assert mats["openai"][0]["include_tasks"] == "" - - -def test_lite_profile_sets_include_tasks_and_shards_one_task_each(): - import lite_tasks - - defaults = {"autonomous": 10, "conversation": 3, "context": 3} - mats = up.build_provider_matrices( - ["openai:gpt"], - ["autonomous", "conversation", "context"], - shard_parallel=10, - n_shards_by_cat=defaults, - dcode_impl="bare", - profile="lite", - ) - by_cat = {e["category"]: e for e in mats["openai"]} - for cat in ("autonomous", "conversation", "context"): - n = len(lite_tasks.LITE_TASKS[cat]) - assert by_cat[cat]["include_tasks"] == " ".join(lite_tasks.LITE_TASKS[cat]) - # One task per shard: max-parallel drains the queue, GH pulls the next - # single-task shard as each finishes (dynamic load-balancing). - assert by_cat[cat]["n_shards"] == n - assert by_cat["autonomous"]["n_shards"] == 15 - - -def test_lite_shards_independent_of_shard_parallel(): - # n_shards is the queue depth (one task each), NOT capped at shard_parallel: - # a small max-parallel just means GH drains the queue in more waves. - mats = up.build_provider_matrices( - ["openai:gpt"], - ["autonomous"], - shard_parallel=2, - n_shards_by_cat={"autonomous": 10}, - profile="lite", - ) - assert mats["openai"][0]["n_shards"] == 15 - - def test_main_rejects_invalid_profile(tmp_path, monkeypatch): import pytest @@ -166,21 +55,12 @@ def test_main_rejects_invalid_profile(tmp_path, monkeypatch): up.main() -def test_langsmith_dataset_is_empty_for_shared_dataset(): - # No per-model dataset name: the leaf derives the canonical shared dataset, - # so every entry's langsmith_dataset is empty regardless of the model spec. - mats = up.build_provider_matrices( - ["openrouter:foo/bar", "openrouter:foo-bar"], - ["context"], - shard_parallel=10, - n_shards_by_cat={"context": 3}, - ) - assert all(e["langsmith_dataset"] == "" for e in mats["openrouter"]) - - def test_main_dedupes_repeated_categories(tmp_path, monkeypatch): + import lite_tasks + monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus") monkeypatch.setenv("UNIFIED_CATEGORIES", "context,context,context") + monkeypatch.setenv("UNIFIED_PROFILE", "lite") monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) assert up.main([]) == 0 import json as _j @@ -188,30 +68,10 @@ def test_main_dedupes_repeated_categories(tmp_path, monkeypatch): lines = dict( line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines() ) - anth = _j.loads(lines["anthropic_matrix"]) - assert len(anth["include"]) == 1 # one entry, not three - - -def test_main_emits_per_provider_outputs(tmp_path, monkeypatch): - out = tmp_path / "gh_out" - monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus, openai:gpt") - monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous,context") - monkeypatch.setenv("UNIFIED_CONCURRENCY", "4") - monkeypatch.setenv("UNIFIED_SHARD_PARALLEL", "10") - monkeypatch.setenv("GITHUB_OUTPUT", str(out)) - rc = up.main([]) - assert rc == 0 - text = out.read_text() - lines = dict(line.split("=", 1) for line in text.splitlines()) - assert lines["anthropic_has_models"] == "true" - assert lines["openai_has_models"] == "true" - assert lines["fireworks_has_models"] == "false" - assert lines["effective_shard_parallel"] == "10" - import json as _j - - anth = _j.loads(lines["anthropic_matrix"]) - assert len(anth["include"]) == 2 # 1 model x 2 categories - assert "providers" not in lines + assert _j.loads(lines["categories"]) == ["context"] # one entry, not three + # the flat matrix isn't tripled either: one shard per context task + matrix = _j.loads(lines["model_0_matrix"])["include"] + assert len(matrix) == len(lite_tasks.LITE_TASKS["context"]) def test_main_rejects_invalid_concurrency(tmp_path, monkeypatch): @@ -226,98 +86,6 @@ def test_main_rejects_invalid_concurrency(tmp_path, monkeypatch): up.main([]) -def test_main_rejects_invalid_shard_parallel(tmp_path, monkeypatch): - monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus") - monkeypatch.setenv("UNIFIED_CATEGORIES", "context") - monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) - import pytest - - for raw in ("not-an-integer", "", "1.5", "-1", "0"): - monkeypatch.setenv("UNIFIED_SHARD_PARALLEL", raw) - with pytest.raises(SystemExit, match=r"UNIFIED_SHARD_PARALLEL.*>= 1"): - up.main([]) - - -def test_main_accepts_large_shard_parallel_and_clamps_to_resource_limits( - tmp_path, monkeypatch -): - cases = [ - ("anthropic:a", "8", "5"), - ( - "anthropic:a,baseten:b,fireworks:c,google_genai:d,groq:e," - "nvidia:f,openai:g,xai:h", - "1", - "10", - ), - ] - for index, (models, concurrency, expected) in enumerate(cases): - out = tmp_path / f"o{index}" - monkeypatch.setenv("UNIFIED_MODELS", models) - monkeypatch.setenv("UNIFIED_CATEGORIES", "context") - monkeypatch.setenv("UNIFIED_CONCURRENCY", concurrency) - monkeypatch.setenv("UNIFIED_SHARD_PARALLEL", "1000") - monkeypatch.setenv("GITHUB_OUTPUT", str(out)) - - assert up.main([]) == 0 - lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) - assert lines["effective_shard_parallel"] == expected - - -def test_main_rejects_invalid_category_shard_counts(tmp_path, monkeypatch): - variables = ( - "UNIFIED_N_SHARDS_AUTONOMOUS", - "UNIFIED_N_SHARDS_CONVERSATION", - "UNIFIED_N_SHARDS_CONTEXT", - ) - invalid = ( - "not-an-integer", - "", - "1.5", - "-1", - "0", - str(shard_matrix.MAX_SHARDS + 1), - ) - monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus") - monkeypatch.setenv("UNIFIED_CATEGORIES", "context") - monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) - import pytest - - for variable in variables: - for raw in invalid: - for current in variables: - monkeypatch.setenv(current, "1") - monkeypatch.setenv(variable, raw) - with pytest.raises( - SystemExit, - match=rf"{variable}.*1\.\.{shard_matrix.MAX_SHARDS}", - ): - up.main([]) - - -def test_main_accepts_category_shard_count_boundaries(tmp_path, monkeypatch): - variables = { - "autonomous": "UNIFIED_N_SHARDS_AUTONOMOUS", - "conversation": "UNIFIED_N_SHARDS_CONVERSATION", - "context": "UNIFIED_N_SHARDS_CONTEXT", - } - monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus") - import json as _j - - for category, variable in variables.items(): - for boundary in (1, shard_matrix.MAX_SHARDS): - out = tmp_path / f"{category}-{boundary}" - for current in variables.values(): - monkeypatch.setenv(current, "1") - monkeypatch.setenv(variable, str(boundary)) - monkeypatch.setenv("UNIFIED_CATEGORIES", category) - monkeypatch.setenv("GITHUB_OUTPUT", str(out)) - - assert up.main([]) == 0 - lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) - matrix = _j.loads(lines["anthropic_matrix"]) - assert matrix["include"][0]["n_shards"] == boundary - - def test_main_rejects_bad_spec(tmp_path, monkeypatch): monkeypatch.setenv("UNIFIED_MODELS", "no-colon-here") monkeypatch.setenv("UNIFIED_CATEGORIES", "context") @@ -343,6 +111,7 @@ def test_main_rejects_empty_categories(tmp_path, monkeypatch): def test_main_emits_expected_models_and_categories(tmp_path, monkeypatch): monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus, openai:gpt") monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous,context") + monkeypatch.setenv("UNIFIED_PROFILE", "lite") monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) assert up.main([]) == 0 import json as _j @@ -354,25 +123,6 @@ def test_main_emits_expected_models_and_categories(tmp_path, monkeypatch): assert _j.loads(lines["categories"]) == ["autonomous", "context"] -def test_main_routes_unknown_provider_into_other_bucket(tmp_path, monkeypatch): - # A spec whose prefix isn't a KNOWN_PROVIDER still resolves (the resolver - # doesn't allowlist providers), and must land in the "other" matrix rather - # than being silently dropped from every provider bucket. - out = tmp_path / "o" - monkeypatch.setenv("UNIFIED_MODELS", "weirdvendor:x") - monkeypatch.setenv("UNIFIED_CATEGORIES", "context") - monkeypatch.setenv("GITHUB_OUTPUT", str(out)) - assert up.main([]) == 0 - import json as _j - - lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) - assert lines["other_has_models"] == "true" - assert lines["anthropic_has_models"] == "false" - other = _j.loads(lines["other_matrix"]) - assert [e["model"] for e in other["include"]] == ["weirdvendor:x"] - assert other["include"][0]["provider"] == "other" - - def test_total_job_guard_allows_within_budget(): up.total_job_guard(n_models=2, est_tasks_per_model=142) # 284 <= 400, no raise @@ -416,3 +166,25 @@ def test_build_flat_matrix_packs_above_cap(): # every task still present, split across include_tasks strings seen = " ".join(e["include_tasks"] for e in entries).split() assert seen == tasks["autonomous"] + + +def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): + import json as _j + out = tmp_path / "o" + monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt, anthropic:opus") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous,conversation,context") + monkeypatch.setenv("UNIFIED_PROFILE", "lite") + monkeypatch.setenv("UNIFIED_CONCURRENCY", "4") + monkeypatch.setenv("UNIFIED_ROLLOUTS", "3") + monkeypatch.setenv("GITHUB_OUTPUT", str(out)) + assert up.main([]) == 0 + lines = dict(l.split("=", 1) for l in out.read_text().splitlines()) + slugs = _j.loads(lines["model_slugs"]) + assert len(slugs) == 2 + assert lines["max_parallel"] == "13" # conc4,roll3 -> 40//3 + assert lines["model_parallel"] == "2" # 80//13=6 -> min(6, 2 models) + m0 = _j.loads(lines["model_0_matrix"])["include"] + # lite totals 15+11+8 = 34 single-task shards per model + assert len(m0) == 34 + assert {e["category"] for e in m0} == {"autonomous", "conversation", "context"} + assert "openai_matrix" not in lines # provider outputs removed diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index f5422569468..cc31eab9fe4 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -1,13 +1,21 @@ """Prep step for the unified multi-model Harbor evals orchestrator. Parses a free-form comma-separated model CSV, validates it via models.py, -buckets specs by provider, clamps shard_parallel to satisfy the two -concurrency invariants, maps each category to its Harbor dataset, and emits -per-provider matrices to GITHUB_OUTPUT. - -Concurrency invariants: - per model: concurrency * shard_parallel <= 40 - global: num_providers * shard_parallel <= 80 +maps each category to its Harbor dataset, and emits a per-model flat matrix +(one entry per single-task shard, spanning every category) to GITHUB_OUTPUT. + +Pool sizing is derived by `derive_pool`, not clamped after the fact: given +`concurrency` (trials in flight per task) and `rollouts` (trials per task), +`per_shard = min(concurrency, rollouts)` is the peak concurrent trials a +single 1-task shard ever runs. `max_parallel = MAX_TASKS_PER_MODEL // +per_shard` saturates the per-model 40-trial budget, and `model_parallel = +MAX_RUNNERS // max_parallel` bounds how many models run at once so total +runners stay within MAX_RUNNERS. Both invariants hold by construction: + per model: concurrency * max_parallel <= MAX_TASKS_PER_MODEL (40) + global: model_parallel * max_parallel <= MAX_RUNNERS (80) +`total_job_guard` separately caps the total job count (n_models * est_tasks) +against a fixed budget so an oversized selection fails fast instead of +launching a firehose. """ from __future__ import annotations @@ -55,8 +63,6 @@ }, } -DEFAULT_N_SHARDS = {"autonomous": 10, "conversation": 3, "context": 3} - # Harnesses selectable for the code categories (autonomous, context) via the # `agent_impl` input. Conversation is always tau3 and is never overridden. CODE_AGENT_IMPLS = {"dcode", "bare"} @@ -124,15 +130,6 @@ def provider_of(spec: str, known: set[str] = KNOWN_PROVIDERS) -> str: return prefix if prefix in known else "other" -def clamp_shard_parallel(requested: int, num_providers: int, concurrency: int) -> int: - sp = min( - requested, - MAX_RUNNERS // max(num_providers, 1), - MAX_TASKS_PER_MODEL // max(concurrency, 1), - ) - return max(sp, 1) - - def derive_pool( concurrency: int, rollouts: int, n_shards: int, n_models: int ) -> tuple[int, int]: @@ -186,64 +183,6 @@ def build_flat_matrix( return entries -def build_provider_matrices( - models_list: list[str], - categories: list[str], - shard_parallel: int, - n_shards_by_cat: dict[str, int], - dcode_impl: str = "dcode", - profile: str = "full", -) -> dict[str, list[dict]]: - matrices: dict[str, list[dict]] = {} - for spec in models_list: - prov = provider_of(spec) - for cat in categories: - cm = CATEGORY_MAP[cat] - # `dcode_impl` swaps the harness for the code categories only; the - # conversation category's tau3 harness is left untouched. - agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] - # `lite` runs a frozen high-signal subset (full rollouts, fewer tasks). - # One task per shard: `shard_parallel` (the leaf's matrix max-parallel) - # is the number of concurrent runner slots, and GitHub pulls the next - # single-task shard in the instant one finishes. That gives dynamic - # load-balancing across runners -- the long pole is the slowest single - # task, not a static bucket -- and scatters each task's image onto its - # own runner so heavy images never concentrate and blow the disk. - # Bounded by shard_matrix.MAX_SHARDS (and its 256-job matrix guard). - include = lite_tasks.include_tasks(cat) if profile == "lite" else "" - n_shards = n_shards_by_cat.get(cat, DEFAULT_N_SHARDS[cat]) - if include: - n_tasks = len(include.split()) - n_shards = min(n_tasks, shard_matrix.MAX_SHARDS) - entry = { - "model": spec, - "provider": prov, - "category": cat, - "dataset": cm["dataset"], - "dataset_path": cm["dataset_path"], - "agent_impl": agent_impl, - "include_tasks": include, - # Empty: the leaf derives the canonical shared dataset name per - # category (harbor-index/harbor-index-1.0, tau3-subset, local/...) - # and a stable per-run experiment name, so a model's shards attach - # to the one shared dataset. NOTE: consolidating those shards into a - # SINGLE experiment per model needs harbor > 0.1.1. Released - # harbor-langsmith==0.1.1 suffixes every shard's experiment with - # "-{job.id[:8]}" (one experiment per shard); harbor main honors the - # explicit experiment_name _harbor_run.yml sets and reuses the - # session across shards. Until a fixed release ships, set the - # `harbor_package_override` input to a harbor build with that fix, - # e.g. commit af2e8629e95c2e9f487f7a2ba87c1e25b531a55b (see that - # input's description for the full pip specs). The GH-aggregated - # unified_summary is the cross-model surface regardless. - "langsmith_dataset": "", - "n_shards": n_shards, - "shard_parallel": shard_parallel, - } - matrices.setdefault(prov, []).append(entry) - return matrices - - def _emit(github_output: str | None, outputs: dict[str, object]) -> None: if not github_output: for k, v in outputs.items(): @@ -275,20 +214,9 @@ def main(argv: list[str] | None = None) -> int: minimum=1, maximum=MAX_TASKS_PER_MODEL, ) - requested_sp = parse_int_input( - "UNIFIED_SHARD_PARALLEL", - os.environ.get("UNIFIED_SHARD_PARALLEL", "10"), - minimum=1, + rollouts = parse_int_input( + "UNIFIED_ROLLOUTS", os.environ.get("UNIFIED_ROLLOUTS", "3"), minimum=1 ) - n_shards_by_cat = { - category: parse_int_input( - f"UNIFIED_N_SHARDS_{category.upper()}", - os.environ.get(f"UNIFIED_N_SHARDS_{category.upper()}", str(default)), - minimum=1, - maximum=shard_matrix.MAX_SHARDS, - ) - for category, default in DEFAULT_N_SHARDS.items() - } # Empty defaults to "dcode" (the historical per-category default). dcode_impl = os.environ.get("UNIFIED_AGENT_IMPL", "").strip() or "dcode" @@ -317,41 +245,45 @@ def main(argv: list[str] | None = None) -> int: except ValueError as exc: raise SystemExit(str(exc)) - providers_present: list[str] = [] - seen = set() - for spec in model_specs: - p = provider_of(spec) - if p not in seen: - seen.add(p) - providers_present.append(p) + # Resolve the per-category task lists. + if profile == "lite": + tasks_by_cat = {c: list(lite_tasks.LITE_TASKS.get(c, [])) for c in categories} + else: + tasks_json = os.environ.get("UNIFIED_TASKS_JSON", "").strip() + if not tasks_json: + raise SystemExit("full profile requires UNIFIED_TASKS_JSON (enumerated tasks).") + with open(tasks_json) as f: + tasks_by_cat = json.load(f) - shard_parallel = clamp_shard_parallel( - requested_sp, len(providers_present), concurrency - ) - # clamp guarantees both invariants; assert as a safety net. - assert concurrency * shard_parallel <= MAX_TASKS_PER_MODEL - assert len(providers_present) * shard_parallel <= MAX_RUNNERS + n_models = len(model_specs) + est_tasks = max((sum(len(tasks_by_cat.get(c, [])) for c in categories), 1)) + total_job_guard(n_models, est_tasks) - matrices = build_provider_matrices( - model_specs, categories, shard_parallel, n_shards_by_cat, dcode_impl, profile - ) + # n_shards for the pool = number of single-task shards (pre-pack); derive pool. + n_shards = est_tasks + max_parallel, model_parallel = derive_pool(concurrency, rollouts, n_shards, n_models) outputs: dict[str, object] = { - "effective_shard_parallel": str(shard_parallel), # The expected grid, so the combiner can flag missing/incomplete leaves # instead of silently ranking a model on fewer categories. "models": model_specs, "categories": categories, + "max_parallel": str(max_parallel), + "model_parallel": str(model_parallel), + "model_slugs": [_slug(m) for m in model_specs], } - for prov in sorted(KNOWN_PROVIDERS | {"other"}): - include = matrices.get(prov, []) - outputs[f"{prov}_has_models"] = "true" if include else "false" - if include: - outputs[f"{prov}_matrix"] = {"include": include} - + for idx, model in enumerate(model_specs): + entries = build_flat_matrix(model, categories, tasks_by_cat, dcode_impl) + outputs[f"model_{idx}_matrix"] = {"include": entries} _emit(os.environ.get("GITHUB_OUTPUT"), outputs) return 0 +def _slug(model: str) -> str: + import re + + return re.sub(r"[^A-Za-z0-9._-]", "-", model.replace("/", "-").replace(":", "-")) + + if __name__ == "__main__": raise SystemExit(main()) From afebdae9649ff1c8b0f817191159c2743c65f379 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 15:22:50 -0400 Subject: [PATCH 27/48] feat(evals): drive _harbor_run harbor job from a flat per-model matrix --- .github/scripts/test_unified_workflow.py | 68 +++++++++++++++++++++ .github/workflows/_harbor_run.yml | 75 ++++++++++++++++++++---- 2 files changed, 133 insertions(+), 10 deletions(-) diff --git a/.github/scripts/test_unified_workflow.py b/.github/scripts/test_unified_workflow.py index 0591be5a764..ae4855d479a 100644 --- a/.github/scripts/test_unified_workflow.py +++ b/.github/scripts/test_unified_workflow.py @@ -435,6 +435,74 @@ def test_override_inputs_warn_against_mutable_or_credentialed_sources() -> None: assert descriptions[0] == descriptions[1] +def test_harbor_run_accepts_flat_matrix_and_derives_parallel_pool() -> None: + """Wire a flat per-model matrix through prep without losing the single-dataset path.""" + workflow = HARBOR_WORKFLOW.read_text() + call_inputs = _indented_block(workflow, " inputs:") + assert 'flat_matrix:' in call_inputs + assert 'max_parallel:' in call_inputs + flat_matrix_input = _indented_block(call_inputs, " flat_matrix:") + assert 'default: ""' in flat_matrix_input + max_parallel_input = _indented_block(call_inputs, " max_parallel:") + assert 'default: "0"' in max_parallel_input + + prep_job = _indented_block(workflow, " prep:") + assert ( + "matrix: ${{ steps.resolve-matrix.outputs.matrix }}" in prep_job + ) + assert ( + "effective_max_parallel: ${{ steps.resolve-matrix.outputs.effective_max_parallel }}" + in prep_job + ) + expand_step = _indented_block(prep_job, ' - name: "🔀 Expand matrix by shard"') + assert "if: ${{ inputs.flat_matrix == '' }}" in expand_step + + resolve_step = _indented_block(prep_job, ' - name: "🧮 Resolve matrix + parallel pool"') + assert 'FLAT_MATRIX: ${{ inputs.flat_matrix }}' in resolve_step + assert 'MAX_PARALLEL: ${{ inputs.max_parallel }}' in resolve_step + assert 'SHARD_PARALLEL: ${{ inputs.shard_parallel }}' in resolve_step + assert 'if [ -n "$FLAT_MATRIX" ]; then' in resolve_step + assert 'matrix="$FLAT_MATRIX"' in resolve_step + assert 'echo "matrix=$matrix"' in resolve_step + assert ( + 'if [[ "$MAX_PARALLEL" =~ ^[0-9]+$ ]] && [ "$MAX_PARALLEL" -gt 0 ]; then' + in resolve_step + ) + assert 'effective_max_parallel="$MAX_PARALLEL"' in resolve_step + assert 'effective_max_parallel="$SHARD_PARALLEL"' in resolve_step + assert 'echo "effective_max_parallel=$effective_max_parallel"' in resolve_step + + harbor_job = _indented_block(workflow, " harbor:") + strategy = _indented_block(harbor_job, " strategy:") + assert ( + "max-parallel: ${{ fromJson(needs.prep.outputs.effective_max_parallel) }}" + in strategy + ) + + job_env = _indented_block(harbor_job, " env:") + assert ( + "HARBOR_DATASET: ${{ matrix.dataset || inputs.dataset || 'terminal-bench/terminal-bench-2' }}" + in job_env + ) + assert ( + "HARBOR_DATASET_PATH: ${{ matrix.dataset_path || inputs.dataset_path }}" + in job_env + ) + assert ( + "HARBOR_AGENT_IMPL: ${{ matrix.agent_impl || inputs.agent_impl }}" in job_env + ) + assert ( + "HARBOR_INCLUDE_TASKS: ${{ matrix.include_tasks || inputs.include_tasks }}" + in job_env + ) + assert ( + "HARBOR_N_SHARDS: ${{ matrix.n_shards || needs.prep.outputs.n_shards || '1' }}" + in job_env + ) + assert "HARBOR_CATEGORY: ${{ matrix.category || inputs.category }}" in job_env + assert "HARBOR_SHARD_INDEX: ${{ matrix.shard }}" in job_env + + def test_evals_ci_filter_includes_unified_workflows() -> None: """Run evals CI when either unified workflow changes in isolation.""" workflow = CI_WORKFLOW.read_text() diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index ce1eccda9eb..5313275bdc6 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -31,6 +31,19 @@ on: shard_parallel: type: string default: "10" + flat_matrix: + # A pre-expanded `{"include":[...]}` job matrix (one entry per + # model/category/shard leaf), e.g. from a unified multi-model dispatch. + # When non-empty, `prep` passes it through verbatim instead of running + # `shard_matrix.py`'s single-dataset expansion. + type: string + default: "" + max_parallel: + # Explicit size of the harbor job's parallel runner pool, for a caller + # driving `flat_matrix` across several models/categories at once. 0 + # falls back to `shard_parallel` (today's single-dataset behavior). + type: string + default: "0" concurrency: type: string default: "4" @@ -89,16 +102,24 @@ jobs: runs-on: ubuntu-latest environment: evals outputs: - matrix: ${{ steps.shard-matrix.outputs.matrix }} + matrix: ${{ steps.resolve-matrix.outputs.matrix }} # Effective shard count after capping to the selectable work (<= n_shards). # The harbor job reads this so its partition matches the emitted matrix. - n_shards: ${{ steps.shard-matrix.outputs.n_shards }} + n_shards: ${{ steps.resolve-matrix.outputs.n_shards }} + # Size of the harbor job's parallel runner pool: an explicit max_parallel + # override when the caller supplied one, else the per-leaf shard_parallel + # (today's behavior). + effective_max_parallel: ${{ steps.resolve-matrix.outputs.effective_max_parallel }} steps: - name: "📋 Checkout Code" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: "🔀 Expand matrix by shard" id: shard-matrix + # Only the single-dataset path needs this expansion; a caller supplying + # flat_matrix has already pre-expanded its own model/category/shard + # entries (see the passthrough step below). + if: ${{ inputs.flat_matrix == '' }} # This leaf evaluates exactly ONE model (inputs.model), so the model # matrix is a single-entry include (no models.py/validate_harbor_limits # step needed here). Cross-products it with the shard axis, caps the @@ -111,6 +132,35 @@ jobs: N_TASKS: ${{ inputs.n_tasks }} run: python .github/scripts/shard_matrix.py + - name: "🧮 Resolve matrix + parallel pool" + id: resolve-matrix + # Picks the flat_matrix passthrough or the shard-matrix expansion + # (whichever ran) and derives the parallel pool, all in bash so the + # fallback logic isn't an inline `fromJson`/ternary expression. + env: + FLAT_MATRIX: ${{ inputs.flat_matrix }} + SHARD_MATRIX: ${{ steps.shard-matrix.outputs.matrix }} + SHARD_N_SHARDS: ${{ steps.shard-matrix.outputs.n_shards }} + MAX_PARALLEL: ${{ inputs.max_parallel }} + SHARD_PARALLEL: ${{ inputs.shard_parallel }} + run: | + if [ -n "$FLAT_MATRIX" ]; then + matrix="$FLAT_MATRIX" + else + matrix="$SHARD_MATRIX" + fi + { + echo "matrix=$matrix" + echo "n_shards=$SHARD_N_SHARDS" + } >> "$GITHUB_OUTPUT" + + if [[ "$MAX_PARALLEL" =~ ^[0-9]+$ ]] && [ "$MAX_PARALLEL" -gt 0 ]; then + effective_max_parallel="$MAX_PARALLEL" + else + effective_max_parallel="$SHARD_PARALLEL" + fi + echo "effective_max_parallel=$effective_max_parallel" >> "$GITHUB_OUTPUT" + harbor: name: "📊 Evals - Harbor (${{ matrix.model }} / ${{ inputs.sandbox_env }} / ${{ inputs.agent_impl }})" needs: prep @@ -122,7 +172,7 @@ jobs: actions: read strategy: fail-fast: false - max-parallel: ${{ fromJson(inputs.shard_parallel) }} + max-parallel: ${{ fromJson(needs.prep.outputs.effective_max_parallel) }} matrix: ${{ fromJson(needs.prep.outputs.matrix) }} defaults: @@ -130,11 +180,11 @@ jobs: working-directory: libs/evals env: UV_NO_SYNC: "true" - HARBOR_DATASET: ${{ inputs.dataset || 'terminal-bench/terminal-bench-2' }} - HARBOR_DATASET_PATH: ${{ inputs.dataset_path }} + HARBOR_DATASET: ${{ matrix.dataset || inputs.dataset || 'terminal-bench/terminal-bench-2' }} + HARBOR_DATASET_PATH: ${{ matrix.dataset_path || inputs.dataset_path }} HARBOR_CONCURRENCY: ${{ inputs.concurrency }} HARBOR_N_TASKS: ${{ inputs.n_tasks }} - HARBOR_INCLUDE_TASKS: ${{ inputs.include_tasks }} + HARBOR_INCLUDE_TASKS: ${{ matrix.include_tasks || inputs.include_tasks }} HARBOR_ROLLOUTS_PER_TASK: ${{ inputs.rollouts }} HARBOR_N_RETRIES: ${{ inputs.n_retries || '0' }} HARBOR_AGENT_TIMEOUT_MULTIPLIER: ${{ inputs.agent_timeout_multiplier || '1.0' }} @@ -143,12 +193,17 @@ jobs: HARBOR_DISABLE_VERIFICATION: ${{ inputs.disable_verification || 'false' }} HARBOR_FORCE_BUILD: ${{ inputs.force_build || 'false' }} HARBOR_SHARD_INDEX: ${{ matrix.shard }} - # Effective shard count from prep (capped to selectable work), not the raw - # input — the partition must match the matrix or tasks would be dropped. - HARBOR_N_SHARDS: ${{ needs.prep.outputs.n_shards || '1' }} + # A flat_matrix entry carries its own (already-effective) n_shards; + # otherwise fall back to prep's effective shard count (capped to + # selectable work), not the raw input — the partition must match the + # matrix or tasks would be dropped. + HARBOR_N_SHARDS: ${{ matrix.n_shards || needs.prep.outputs.n_shards || '1' }} HARBOR_SANDBOX_ENV: ${{ inputs.sandbox_env }} - HARBOR_AGENT_IMPL: ${{ inputs.agent_impl }} + HARBOR_AGENT_IMPL: ${{ matrix.agent_impl || inputs.agent_impl }} HARBOR_MODEL: ${{ matrix.model }} + # Per-leaf category, so a multi-category flat_matrix run can be + # aggregated per category downstream. + HARBOR_CATEGORY: ${{ matrix.category || inputs.category }} HARBOR_LS_DATASET_OVERRIDE: ${{ inputs.langsmith_dataset }} HARBOR_JUDGE_MODELS: ${{ inputs.judge_models || 'gpt-5.6-luna' }} LANGSMITH_TRACING: "true" From 2ab14ad51c102cc52f2797c0e405e0239334e4bc Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 15:56:28 -0400 Subject: [PATCH 28/48] feat(evals): aggregate flat-matrix shards per category tag --- .github/scripts/test_unified_workflow.py | 54 ++++++++- .github/workflows/_harbor_run.yml | 144 ++++++++++++++++++++--- 2 files changed, 182 insertions(+), 16 deletions(-) diff --git a/.github/scripts/test_unified_workflow.py b/.github/scripts/test_unified_workflow.py index ae4855d479a..bbdb681bdd5 100644 --- a/.github/scripts/test_unified_workflow.py +++ b/.github/scripts/test_unified_workflow.py @@ -297,18 +297,68 @@ def test_leaf_aggregation_requires_every_expected_shard() -> None: """Count successful empty shards while detecting missing artifacts.""" workflow = HARBOR_WORKFLOW.read_text() harbor = _indented_block(workflow, " harbor:") + prep_job = _indented_block(workflow, " prep:") aggregate = _indented_block(workflow, " aggregate:") + # Category-scoped so independently-sharded categories in a flat multi-category + # run can't collide on the same shard index's marker basename (aggregate_shards.py + # counts markers by basename alone). assert ( - 'touch "harbor-jobs/terminal-bench/empty-shard-$HARBOR_SHARD_INDEX"' in harbor + 'touch "harbor-jobs/terminal-bench/empty-shard-${HARBOR_CATEGORY}-${HARBOR_SHARD_INDEX}"' + in harbor ) assert " needs: [prep, harbor]" in aggregate - assert "EXPECTED_SHARDS: ${{ needs.prep.outputs.n_shards }}" in aggregate + # expected_shards now flows per-category via aggregate_matrix (derived in prep + # from prep's own shard-matrix output on the single-dataset path), not a + # single job-level env var on the aggregate job. + assert ( + "SINGLE_EXPECTED_SHARDS: ${{ steps.shard-matrix.outputs.n_shards }}" + in prep_job + ) + assert "EXPECTED_SHARDS: ${{ matrix.expected_shards }}" in aggregate compute = _indented_block(aggregate, ' - name: "📊 Compute pass@k / avg@k"') assert 'expected_shards_args=(--expected-shards "$EXPECTED_SHARDS")' in compute assert '"${expected_shards_args[@]}"' in compute +def test_aggregate_runs_per_category() -> None: + """Aggregate matrixes over categories instead of hardcoding a single one.""" + text = HARBOR_WORKFLOW.read_text() + # aggregate loops over the categories present in the flat matrix + assert "for cat in" in text or "matrix.category" in text + assert "aggregate_shards.py" in text + assert "--category" in text + + workflow = HARBOR_WORKFLOW.read_text() + prep_job = _indented_block(workflow, " prep:") + aggregate_job = _indented_block(workflow, " aggregate:") + + assert "aggregate_matrix: ${{ steps.agg-matrix.outputs.aggregate_matrix }}" in prep_job + derive_step = _indented_block(prep_job, ' - name: "🗂️ Derive aggregate matrix"') + assert "FLAT_MATRIX: ${{ inputs.flat_matrix }}" in derive_step + assert "expected_shards" in derive_step + + aggregate_strategy = _indented_block(aggregate_job, " strategy:") + assert ( + "matrix: ${{ fromJson(needs.prep.outputs.aggregate_matrix) }}" + in aggregate_strategy + ) + + compute = _indented_block( + aggregate_job, ' - name: "📊 Compute pass@k / avg@k"' + ) + assert "DATASET: ${{ matrix.dataset }}" in compute + assert "CATEGORY: ${{ matrix.category }}" in compute + assert "--category" in compute + + upload = _indented_block(aggregate_job, ' - name: "📤 Upload combined results"') + assert "format('harbor-combined-{0}', steps.slug.outputs.slug)" in upload + assert ( + "format('harbor-combined-{0}-{1}', matrix.category, steps.slug.outputs.slug)" + in upload + ) + + def test_chart_publishers_are_serialized_and_replace_rerun_assets() -> None: """Protect the shared branch from concurrent pushes and stale rerun files.""" publishers = [ diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 5313275bdc6..7db1a1b074d 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -110,6 +110,11 @@ jobs: # override when the caller supplied one, else the per-leaf shard_parallel # (today's behavior). effective_max_parallel: ${{ steps.resolve-matrix.outputs.effective_max_parallel }} + # One entry per category to aggregate: a single entry for the plain + # single-dataset call, or (on a flat multi-category run) one entry per + # distinct category present in flat_matrix. The `aggregate` job matrixes + # over this. + aggregate_matrix: ${{ steps.agg-matrix.outputs.aggregate_matrix }} steps: - name: "📋 Checkout Code" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -161,6 +166,74 @@ jobs: fi echo "effective_max_parallel=$effective_max_parallel" >> "$GITHUB_OUTPUT" + - name: "🗂️ Derive aggregate matrix" + id: agg-matrix + # One aggregate_shards.py invocation per category: the single-dataset + # path (flat_matrix empty) emits exactly one entry; a flat + # multi-category run emits one entry per distinct category present in + # flat_matrix, with expected_shards = the number of flat_matrix entries + # carrying that category (each entry is one shard job). + env: + FLAT_MATRIX: ${{ inputs.flat_matrix }} + SINGLE_CATEGORY: ${{ inputs.category }} + SINGLE_DATASET: ${{ inputs.dataset }} + SINGLE_EXPECTED_SHARDS: ${{ steps.shard-matrix.outputs.n_shards }} + run: | + python - <<'PY' + import json + import os + import re + import sys + + flat_matrix = os.environ.get("FLAT_MATRIX", "").strip() + category_re = re.compile(r"^[A-Za-z0-9_.-]+$") + + if flat_matrix: + try: + data = json.loads(flat_matrix) + except json.JSONDecodeError as exc: + sys.exit(f"::error::Invalid flat_matrix JSON: {exc}") + by_category: dict[str, dict] = {} + for entry in data.get("include", []): + category = entry.get("category") + if not category or not category_re.match(str(category)): + sys.exit( + f"::error::Invalid or missing category in flat_matrix entry: {category!r}" + ) + info = by_category.setdefault(category, {"count": 0, "dataset": None}) + info["count"] += 1 + if info["dataset"] is None: + info["dataset"] = entry.get("dataset") or entry.get("dataset_path") or "" + if not by_category: + sys.exit("::error::flat_matrix produced no categories to aggregate") + include = [ + { + "category": category, + "dataset": info["dataset"] or "", + "expected_shards": info["count"], + } + for category, info in sorted(by_category.items()) + ] + else: + raw_expected = os.environ.get("SINGLE_EXPECTED_SHARDS", "").strip() + include = [ + { + "category": os.environ.get("SINGLE_CATEGORY", ""), + "dataset": os.environ.get("SINGLE_DATASET", ""), + "expected_shards": int(raw_expected) if raw_expected.isdigit() else "", + } + ] + + matrix = {"include": include} + line = "aggregate_matrix=" + json.dumps(matrix, separators=(",", ":")) + github_output = os.environ.get("GITHUB_OUTPUT") + if github_output: + with open(github_output, "a") as fh: + fh.write(line + "\n") + else: + print(line) + PY + harbor: name: "📊 Evals - Harbor (${{ matrix.model }} / ${{ inputs.sandbox_env }} / ${{ inputs.agent_impl }})" needs: prep @@ -430,6 +503,10 @@ jobs: echo "::error::Invalid n_retries (non-negative integer): $HARBOR_N_RETRIES" exit 1 fi + if ! [[ "$HARBOR_CATEGORY" =~ ^[A-Za-z0-9_.-]+$ ]]; then + echo "::error::Invalid Harbor category: $HARBOR_CATEGORY" + exit 1 + fi # Positive decimal only; reject all-zero (0, 0.0, ...) which would mean a 0s timeout. if ! [[ "$HARBOR_AGENT_TIMEOUT_MULTIPLIER" =~ ^[0-9]+(\.[0-9]+)?$ ]] || [[ "$HARBOR_AGENT_TIMEOUT_MULTIPLIER" =~ ^0+(\.0+)?$ ]]; then echo "::error::Invalid agent_timeout_multiplier (must be a positive decimal): $HARBOR_AGENT_TIMEOUT_MULTIPLIER" @@ -578,7 +655,9 @@ jobs: # shard's slice is legitimately empty. Upload a marker so aggregation # can distinguish this successful no-op from a missing shard artifact. mkdir -p harbor-jobs/terminal-bench - touch "harbor-jobs/terminal-bench/empty-shard-$HARBOR_SHARD_INDEX" + # Category-scoped so a flat multi-category run's independently-sharded + # categories can't collide on the same shard index's marker name. + touch "harbor-jobs/terminal-bench/empty-shard-${HARBOR_CATEGORY}-${HARBOR_SHARD_INDEX}" echo "Shard $HARBOR_SHARD_INDEX/$HARBOR_N_SHARDS has no tasks (selection smaller than shard count); skipping." echo "SHARD_EMPTY=true" >> "$GITHUB_ENV" exit 0 @@ -777,7 +856,9 @@ jobs: - name: "🔖 Compute leaf slug" if: always() # Sanitized model+category, used to scope this run's artifact names so - # concurrent runs don't collide. + # concurrent runs don't collide. HARBOR_CATEGORY_SAFE additionally scopes + # the artifact name by category, so a flat multi-category run's shards + # group distinctly per category for the aggregate job. env: MODEL: ${{ inputs.model }} CATEGORY: ${{ inputs.category }} @@ -788,12 +869,19 @@ jobs: slug="${slug}-$(printf '%s' "$raw" | sha256sum | cut -c1-8)" echo "LEAF_SLUG=$slug" >> "$GITHUB_ENV" + category_safe=$(printf '%s' "$HARBOR_CATEGORY" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9' '-' | sed 's/--*/-/g; s/^-//; s/-$//') + if [ -z "$category_safe" ]; then + category_safe="uncategorized" + fi + echo "HARBOR_CATEGORY_SAFE=$category_safe" >> "$GITHUB_ENV" + - name: "📤 Upload Harbor artifacts" if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - # Slug-scoped so the aggregate job globs only this run's shards. - name: shard-${{ env.LEAF_SLUG }}-${{ strategy.job-index }} + # Category- and slug-scoped so the aggregate job globs only this run's + # own shards, grouped per category. + name: shard-${{ env.HARBOR_CATEGORY_SAFE }}-${{ env.LEAF_SLUG }}-${{ strategy.job-index }} path: | libs/evals/harbor-jobs/terminal-bench if-no-files-found: warn @@ -809,6 +897,13 @@ jobs: permissions: contents: read actions: write # download shard artifacts, then delete them after merging + # One leg per category to aggregate: a single leg for the plain + # single-dataset call, or (on a flat multi-category run) one leg per + # distinct category present in flat_matrix, each carrying its own dataset + + # expected_shards. + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.prep.outputs.aggregate_matrix) }} env: GH_TOKEN: ${{ github.token }} REPO: ${{ github.repository }} @@ -817,9 +912,6 @@ jobs: # failed. Empty shards (task-filtered slices) no-op successfully, so a # filtered run is not falsely reported as incomplete. HARBOR_RESULT: ${{ needs.harbor.result }} - # Authoritative effective count after prep caps shards to selectable work. - # Successful empty slices upload markers, so every emitted shard is countable. - EXPECTED_SHARDS: ${{ needs.prep.outputs.n_shards }} steps: - name: "📋 Checkout Code" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -838,13 +930,31 @@ jobs: slug="${slug}-$(printf '%s' "$raw" | sha256sum | cut -c1-8)" echo "slug=$slug" >> "$GITHUB_OUTPUT" + - name: "🔖 Compute category slug" + id: cat-slug + # Sanitized aggregate_matrix category. Must match the harbor job's + # HARBOR_CATEGORY_SAFE byte-for-byte so the download/delete globs below + # hit exactly this category's shard artifacts. + env: + CATEGORY: ${{ matrix.category }} + run: | + if ! [[ "$CATEGORY" =~ ^[A-Za-z0-9_.-]+$ ]]; then + echo "::error::Invalid aggregate category: $CATEGORY" + exit 1 + fi + category_safe=$(printf '%s' "$CATEGORY" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9' '-' | sed 's/--*/-/g; s/^-//; s/-$//') + if [ -z "$category_safe" ]; then + category_safe="uncategorized" + fi + echo "slug=$category_safe" >> "$GITHUB_OUTPUT" + - name: "⬇️ Download shard results" # Distinguish "no artifacts" (a legitimate task-filtered run) from a real # download failure (auth / network / rate-limit). Only the former aggregates # an empty set; anything else fails the step, so a transient failure is never # mistaken for a complete, zero-result run. Transient errors are retried. env: - SHARD_PATTERN: shard-${{ steps.slug.outputs.slug }}-* + SHARD_PATTERN: shard-${{ steps.cat-slug.outputs.slug }}-${{ steps.slug.outputs.slug }}-* run: | attempt=1 while :; do @@ -872,12 +982,16 @@ jobs: - name: "📊 Compute pass@k / avg@k" # Inputs are passed via quoted env (not ${{ }} shell interpolation) to - # avoid workflow-input injection; argparse int-parses --rollouts. + # avoid workflow-input injection; argparse int-parses --rollouts. Dataset, + # category, and expected_shards come from this leg's aggregate_matrix + # entry: on the single-dataset path that entry mirrors inputs.dataset / + # inputs.category / needs.prep.outputs.n_shards exactly. env: - DATASET: ${{ inputs.dataset }} + DATASET: ${{ matrix.dataset }} ROLLOUTS: ${{ inputs.rollouts }} MODEL: ${{ inputs.model }} - CATEGORY: ${{ inputs.category }} + CATEGORY: ${{ matrix.category }} + EXPECTED_SHARDS: ${{ matrix.expected_shards }} run: | if ! [[ "$ROLLOUTS" =~ ^[1-9][0-9]*$ ]]; then echo "::error::Invalid rollouts_per_task: $ROLLOUTS" @@ -900,10 +1014,12 @@ jobs: - name: "📤 Upload combined results" # One zip per category: the merged shard harbor data plus summary.json - # and per_task.jsonl. + # and per_task.jsonl. The single-dataset path (flat_matrix unset) keeps + # the plain unqualified name; a flat multi-category run qualifies it by + # category so each category's combined zip is distinct. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: harbor-combined-${{ steps.slug.outputs.slug }} + name: ${{ inputs.flat_matrix == '' && format('harbor-combined-{0}', steps.slug.outputs.slug) || format('harbor-combined-{0}-{1}', matrix.category, steps.slug.outputs.slug) }} path: _shards if-no-files-found: warn @@ -916,7 +1032,7 @@ jobs: # so the sanitized (a-z0-9- only) prefix is interpolated directly into # the jq string literal below — safe since the slug charset excludes # quotes/backslashes and can't break out of the jq string. - SHARD_PREFIX: shard-${{ steps.slug.outputs.slug }}- + SHARD_PREFIX: shard-${{ steps.cat-slug.outputs.slug }}-${{ steps.slug.outputs.slug }}- run: | ids=$(gh api "repos/$REPO/actions/runs/$RUN_ID/artifacts" --paginate \ --jq ".artifacts[] | select(.name | startswith(\"${SHARD_PREFIX}\")) | .id") From 95a602829e4599ab67cfdd846b2a0d32e6302c71 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 16:12:24 -0400 Subject: [PATCH 29/48] fix(evals): hash category slug to avoid shard-artifact collision Append a short sha256 hash of the raw category (mirroring LEAF_SLUG's technique) to HARBOR_CATEGORY_SAFE and the aggregate job's cat-slug, so two raw categories that sanitize alike (e.g. auto.test vs auto_test) no longer collide on the same shard-artifact glob and silently merge into one aggregation. --- .github/workflows/_harbor_run.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 7db1a1b074d..5141e34730e 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -873,6 +873,11 @@ jobs: if [ -z "$category_safe" ]; then category_safe="uncategorized" fi + # Short hash keeps the category slug injective, mirroring LEAF_SLUG + # above: two raw categories differing only in separators (e.g. + # "auto.test" vs "auto_test") would otherwise sanitize alike and + # collide in aggregate_matrix's per-category shard glob. + category_safe="${category_safe}-$(printf '%s' "$HARBOR_CATEGORY" | sha256sum | cut -c1-8)" echo "HARBOR_CATEGORY_SAFE=$category_safe" >> "$GITHUB_ENV" - name: "📤 Upload Harbor artifacts" @@ -946,6 +951,9 @@ jobs: if [ -z "$category_safe" ]; then category_safe="uncategorized" fi + # Short hash keeps the category slug injective (mirrors the harbor + # job's HARBOR_CATEGORY_SAFE); must match it byte-for-byte. + category_safe="${category_safe}-$(printf '%s' "$CATEGORY" | sha256sum | cut -c1-8)" echo "slug=$category_safe" >> "$GITHUB_OUTPUT" - name: "⬇️ Download shard results" @@ -1016,7 +1024,9 @@ jobs: # One zip per category: the merged shard harbor data plus summary.json # and per_task.jsonl. The single-dataset path (flat_matrix unset) keeps # the plain unqualified name; a flat multi-category run qualifies it by - # category so each category's combined zip is distinct. + # raw matrix.category, which is safe only because the cat-slug step's + # `exit 1` validation (rejects anything outside [A-Za-z0-9_.-]) already + # ran earlier in this job; don't reorder past it. uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: ${{ inputs.flat_matrix == '' && format('harbor-combined-{0}', steps.slug.outputs.slug) || format('harbor-combined-{0}-{1}', matrix.category, steps.slug.outputs.slug) }} From 6182c1fdacc5a551ac2ab87a04d16cd5b6a3625f Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 16:35:06 -0400 Subject: [PATCH 30/48] feat(evals): per-model flat-pool jobs + full-profile enumerate in unified_evals --- .github/scripts/test_unified_prep.py | 30 +- .github/scripts/test_unified_workflow.py | 115 ++++-- .github/scripts/unified_prep.py | 21 +- .github/workflows/unified_evals.yml | 440 +++++++---------------- 4 files changed, 250 insertions(+), 356 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index fa6dff6bd49..0d1f871d617 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -70,7 +70,8 @@ def test_main_dedupes_repeated_categories(tmp_path, monkeypatch): ) assert _j.loads(lines["categories"]) == ["context"] # one entry, not three # the flat matrix isn't tripled either: one shard per context task - matrix = _j.loads(lines["model_0_matrix"])["include"] + eval_matrix = _j.loads(lines["eval_matrix"])["include"] + matrix = _j.loads(eval_matrix[0]["flat_matrix"])["include"] assert len(matrix) == len(lite_tasks.LITE_TASKS["context"]) @@ -178,13 +179,24 @@ def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): monkeypatch.setenv("UNIFIED_ROLLOUTS", "3") monkeypatch.setenv("GITHUB_OUTPUT", str(out)) assert up.main([]) == 0 - lines = dict(l.split("=", 1) for l in out.read_text().splitlines()) - slugs = _j.loads(lines["model_slugs"]) - assert len(slugs) == 2 + lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) assert lines["max_parallel"] == "13" # conc4,roll3 -> 40//3 assert lines["model_parallel"] == "2" # 80//13=6 -> min(6, 2 models) - m0 = _j.loads(lines["model_0_matrix"])["include"] - # lite totals 15+11+8 = 34 single-task shards per model - assert len(m0) == 34 - assert {e["category"] for e in m0} == {"autonomous", "conversation", "context"} - assert "openai_matrix" not in lines # provider outputs removed + eval_matrix = _j.loads(lines["eval_matrix"])["include"] + assert len(eval_matrix) == 2 # one entry per model + assert {e["model"] for e in eval_matrix} == {"openai:gpt", "anthropic:opus"} + for entry in eval_matrix: + assert set(entry) == {"model", "slug", "flat_matrix"} + flat = _j.loads(entry["flat_matrix"])["include"] + # lite totals 15+11+8 = 34 single-task shards per model + assert len(flat) == 34 + assert {e["category"] for e in flat} == { + "autonomous", + "conversation", + "context", + } + # No other output carries per-model or per-provider data; eval_matrix is + # the single source for both. + assert "model_slugs" not in lines + assert "model_0_matrix" not in lines + assert "openai_matrix" not in lines diff --git a/.github/scripts/test_unified_workflow.py b/.github/scripts/test_unified_workflow.py index bbdb681bdd5..e058dc45f3d 100644 --- a/.github/scripts/test_unified_workflow.py +++ b/.github/scripts/test_unified_workflow.py @@ -90,38 +90,20 @@ def test_dispatch_inputs_reach_every_provider_without_changing_categories() -> N categories = _indented_block(dispatch, " categories:") assert 'default: "autonomous,conversation,context"' in categories - conversation_shards = _indented_block(dispatch, " n_shards_conversation:") - assert 'default: "3"' in conversation_shards - - provider_jobs = [ - "eval-anthropic", - "eval-baseten", - "eval-fireworks", - "eval-google_genai", - "eval-groq", - "eval-nvidia", - "eval-ollama", - "eval-openai", - "eval-openrouter", - "eval-xai", - "eval-other", - ] + + # Exactly one reusable-workflow call: the flat-pool `eval` job (see + # test_eval_job_uses_single_flat_pool_matrix below for its shape). reusable_call = "uses: ./.github/workflows/_harbor_run.yml" - assert workflow.count(reusable_call) == len(provider_jobs) - for job_name in provider_jobs: - job = _indented_block(workflow, f" {job_name}:") - assert job.count(reusable_call) == 1 - assert job.count("force_build: ${{ inputs.force_build }}") == 1 - assert ( - job.count("harbor_package_override: ${{ inputs.harbor_package_override }}") - == 1 - ) + assert workflow.count(reusable_call) == 1 + eval_job = _indented_block(workflow, " eval:") + assert eval_job.count("force_build: ${{ inputs.force_build }}") == 1 + assert ( + eval_job.count("harbor_package_override: ${{ inputs.harbor_package_override }}") + == 1 + ) prep_job = _indented_block(workflow, " prep:") assert "UNIFIED_CATEGORIES: ${{ inputs.categories }}" in prep_job - assert ( - "UNIFIED_N_SHARDS_CONVERSATION: ${{ inputs.n_shards_conversation }}" in prep_job - ) assert "run: python .github/scripts/unified_prep.py" in prep_job prep_source = PREP_SCRIPT.read_text() @@ -131,6 +113,83 @@ def test_dispatch_inputs_reach_every_provider_without_changing_categories() -> N assert '"agent_impl": "tau3"' in conversation +def test_eval_job_uses_single_flat_pool_matrix() -> None: + """One eval job matrixes over per-model flat matrices, capped by model_parallel.""" + workflow = UNIFIED_WORKFLOW.read_text() + + prep_job = _indented_block(workflow, " prep:") + prep_outputs = _indented_block(prep_job, " outputs:") + assert "eval_matrix: ${{ steps.p.outputs.eval_matrix }}" in prep_outputs + assert "max_parallel: ${{ steps.p.outputs.max_parallel }}" in prep_outputs + assert "model_parallel: ${{ steps.p.outputs.model_parallel }}" in prep_outputs + assert "models: ${{ steps.p.outputs.models }}" in prep_outputs + assert "categories: ${{ steps.p.outputs.categories }}" in prep_outputs + # No per-provider output or gate exists anywhere in the workflow. + assert "_has_models" not in workflow + + eval_job = _indented_block(workflow, " eval:") + assert "needs: prep" in eval_job + strategy = _indented_block(eval_job, " strategy:") + assert "fail-fast: false" in strategy + assert ( + "max-parallel: ${{ fromJson(needs.prep.outputs.model_parallel) }}" in strategy + ) + assert "matrix: ${{ fromJson(needs.prep.outputs.eval_matrix) }}" in strategy + assert "max-parallel: 1" not in workflow + + eval_with = _indented_block(eval_job, " with:") + assert "model: ${{ matrix.model }}" in eval_with + assert "flat_matrix: ${{ matrix.flat_matrix }}" in eval_with + assert "max_parallel: ${{ needs.prep.outputs.max_parallel }}" in eval_with + # n_shards/shard_parallel/langsmith_dataset/include_tasks are per-shard + # values now carried inside flat_matrix, not passed at the top level. + assert "n_shards:" not in eval_with + assert "shard_parallel:" not in eval_with + assert "langsmith_dataset:" not in eval_with + assert "include_tasks:" not in eval_with + + +def test_enumerate_step_gated_on_full_profile() -> None: + """The task-enumeration step only runs for the full profile; lite skips it.""" + workflow = UNIFIED_WORKFLOW.read_text() + prep_job = _indented_block(workflow, " prep:") + enumerate_step = _indented_block( + prep_job, ' - name: "🔢 Enumerate full-profile tasks"' + ) + assert "if: ${{ inputs.profile == 'full' }}" in enumerate_step + assert "ENUM_DATASET" in enumerate_step + assert "ENUM_DATASET_PATH" in enumerate_step + assert "harbor_adapters.contextbench.main" in enumerate_step + assert "--populate" in enumerate_step + assert "UNIFIED_TASKS_JSON" in enumerate_step + + p_step = _indented_block( + prep_job, ' - name: "🧮 Parse models + build the per-model flat matrix"' + ) + p_env = _indented_block(p_step, " env:") + assert "UNIFIED_MODELS: ${{ inputs.models }}" in p_env + assert "UNIFIED_CATEGORIES: ${{ inputs.categories }}" in p_env + assert "UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }}" in p_env + assert "UNIFIED_PROFILE: ${{ inputs.profile }}" in p_env + assert "UNIFIED_CONCURRENCY: ${{ inputs.concurrency }}" in p_env + assert "UNIFIED_ROLLOUTS: ${{ inputs.rollouts }}" in p_env + assert "UNIFIED_TASKS_JSON: ${{ env.UNIFIED_TASKS_JSON }}" in p_env + assert "UNIFIED_SHARD_PARALLEL" not in workflow + assert "UNIFIED_N_SHARDS_" not in workflow + + +def test_combine_needs_prep_and_eval() -> None: + """Combine waits on the single eval job, not a fixed provider job list.""" + workflow = UNIFIED_WORKFLOW.read_text() + combine_job = _indented_block(workflow, " combine:") + needs = _indented_block(combine_job, " needs:") + assert "- prep" in needs + assert "- eval" in needs + # marker line ("needs:") plus exactly the two job names, no leftover + # provider jobs. + assert len([line for line in needs.splitlines() if line.strip()]) == 3 + + def test_combine_download_classifies_no_artifacts_and_retries_failures() -> None: """Only a genuine empty-artifact response may let combine continue.""" workflow = UNIFIED_WORKFLOW.read_text() diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index cc31eab9fe4..c2a1f404ab1 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -270,11 +270,24 @@ def main(argv: list[str] | None = None) -> int: "categories": categories, "max_parallel": str(max_parallel), "model_parallel": str(model_parallel), - "model_slugs": [_slug(m) for m in model_specs], } - for idx, model in enumerate(model_specs): - entries = build_flat_matrix(model, categories, tasks_by_cat, dcode_impl) - outputs[f"model_{idx}_matrix"] = {"include": entries} + # One eval_matrix entry per model, each carrying its own pre-serialized + # flat matrix. GitHub job outputs are statically declared, so a single + # matrixable output (rather than one `model__matrix` output per + # model) is what lets the `eval` job's `strategy.matrix` scale to an + # arbitrary model count. + eval_include = [ + { + "model": m, + "slug": _slug(m), + "flat_matrix": json.dumps( + {"include": build_flat_matrix(m, categories, tasks_by_cat, dcode_impl)}, + separators=(",", ":"), + ), + } + for m in model_specs + ] + outputs["eval_matrix"] = {"include": eval_include} _emit(os.environ.get("GITHUB_OUTPUT"), outputs) return 0 diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index b4d707b8b54..08c3058b6cf 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -31,18 +31,6 @@ on: concurrency: type: string default: "4" - shard_parallel: - type: string - default: "10" - n_shards_autonomous: - type: string - default: "10" - n_shards_conversation: - type: string - default: "3" - n_shards_context: - type: string - default: "3" sandbox_env: type: string default: "langsmith" @@ -58,7 +46,7 @@ on: permissions: contents: read # Lets the called reusable workflow manage run artifacts; a caller caps the - # callee's token, so it must be granted here (provider jobs inherit this). + # callee's token, so it must be granted here (the eval job inherits this). actions: write concurrency: @@ -67,343 +55,165 @@ concurrency: jobs: prep: - name: "🔧 Parse models + build provider matrices" + name: "🔧 Parse models + build the per-model flat matrix" runs-on: ubuntu-latest environment: evals outputs: - anthropic_matrix: ${{ steps.p.outputs.anthropic_matrix }} - anthropic_has_models: ${{ steps.p.outputs.anthropic_has_models }} - baseten_matrix: ${{ steps.p.outputs.baseten_matrix }} - baseten_has_models: ${{ steps.p.outputs.baseten_has_models }} - fireworks_matrix: ${{ steps.p.outputs.fireworks_matrix }} - fireworks_has_models: ${{ steps.p.outputs.fireworks_has_models }} - google_genai_matrix: ${{ steps.p.outputs.google_genai_matrix }} - google_genai_has_models: ${{ steps.p.outputs.google_genai_has_models }} - groq_matrix: ${{ steps.p.outputs.groq_matrix }} - groq_has_models: ${{ steps.p.outputs.groq_has_models }} - nvidia_matrix: ${{ steps.p.outputs.nvidia_matrix }} - nvidia_has_models: ${{ steps.p.outputs.nvidia_has_models }} - ollama_matrix: ${{ steps.p.outputs.ollama_matrix }} - ollama_has_models: ${{ steps.p.outputs.ollama_has_models }} - openai_matrix: ${{ steps.p.outputs.openai_matrix }} - openai_has_models: ${{ steps.p.outputs.openai_has_models }} - openrouter_matrix: ${{ steps.p.outputs.openrouter_matrix }} - openrouter_has_models: ${{ steps.p.outputs.openrouter_has_models }} - xai_matrix: ${{ steps.p.outputs.xai_matrix }} - xai_has_models: ${{ steps.p.outputs.xai_has_models }} - other_matrix: ${{ steps.p.outputs.other_matrix }} - other_has_models: ${{ steps.p.outputs.other_has_models }} - effective_shard_parallel: ${{ steps.p.outputs.effective_shard_parallel }} + eval_matrix: ${{ steps.p.outputs.eval_matrix }} + max_parallel: ${{ steps.p.outputs.max_parallel }} + model_parallel: ${{ steps.p.outputs.model_parallel }} models: ${{ steps.p.outputs.models }} categories: ${{ steps.p.outputs.categories }} steps: - name: "📋 Checkout Code" uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: "🧮 Parse models + build provider matrices" - id: p - env: - UNIFIED_MODELS: ${{ inputs.models }} - UNIFIED_CATEGORIES: ${{ inputs.categories }} - UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} - UNIFIED_PROFILE: ${{ inputs.profile }} - UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} - UNIFIED_SHARD_PARALLEL: ${{ inputs.shard_parallel }} - UNIFIED_N_SHARDS_AUTONOMOUS: ${{ inputs.n_shards_autonomous }} - UNIFIED_N_SHARDS_CONVERSATION: ${{ inputs.n_shards_conversation }} - UNIFIED_N_SHARDS_CONTEXT: ${{ inputs.n_shards_context }} - run: python .github/scripts/unified_prep.py - - eval-anthropic: - needs: prep - if: needs.prep.outputs.anthropic_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.anthropic_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} - - eval-baseten: - needs: prep - if: needs.prep.outputs.baseten_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.baseten_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + - name: "🐍 Set up Python + UV" + if: ${{ inputs.profile == 'full' }} + uses: "./.github/actions/uv_setup" + with: + python-version: "3.12" + cache-suffix: unified-enumerate + working-directory: libs/evals - eval-fireworks: - needs: prep - if: needs.prep.outputs.fireworks_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.fireworks_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + - name: "📦 Install Dependencies" + if: ${{ inputs.profile == 'full' }} + working-directory: libs/evals + run: uv sync --group test --locked - eval-google_genai: - needs: prep - if: needs.prep.outputs.google_genai_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.google_genai_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + - name: "🔢 Enumerate full-profile tasks" + # Only the full profile needs the live task list per category; lite + # uses the frozen subset baked into lite_tasks.py and skips this + # entirely. Resolves each selected category's task names the same way + # the harbor leaf's own sharding does (enumerate_tasks.py), so + # unified_prep.py's flat matrix always matches the real dataset. + if: ${{ inputs.profile == 'full' }} + id: enumerate + working-directory: libs/evals + env: + UNIFIED_CATEGORIES: ${{ inputs.categories }} + run: | + python3 - <<'PY' + import json + import os + import subprocess + import sys - eval-groq: - needs: prep - if: needs.prep.outputs.groq_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.groq_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + # Category -> dataset mapping mirrors unified_prep.py's CATEGORY_MAP. + # Kept as separate constants here (rather than importing that + # module) since this step runs before unified_prep.py's own + # validation; the two are pinned together by test_unified_workflow.py. + CATEGORY_DATASET = { + "autonomous": "harbor-index/harbor-index-1.0", + "conversation": "tau3-subset", + } + CATEGORY_DATASET_PATH = { + "context": "datasets/context-retrieval-evals", + } + KNOWN_CATEGORIES = set(CATEGORY_DATASET) | set(CATEGORY_DATASET_PATH) - eval-nvidia: - needs: prep - if: needs.prep.outputs.nvidia_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.nvidia_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + raw = os.environ.get("UNIFIED_CATEGORIES", "") + categories = list(dict.fromkeys(c.strip() for c in raw.split(",") if c.strip())) + unknown = [c for c in categories if c not in KNOWN_CATEGORIES] + if unknown: + sys.exit(f"::error::Unknown categor(y/ies) for enumeration: {unknown}") + if not categories: + sys.exit("::error::No categories selected to enumerate for the full profile") - eval-ollama: - needs: prep - if: needs.prep.outputs.ollama_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.ollama_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + enumerate_script = os.path.join( + os.environ["GITHUB_WORKSPACE"], ".github", "scripts", "enumerate_tasks.py" + ) + tasks_by_cat: dict[str, list[str]] = {} + for category in categories: + env = os.environ.copy() + if category in CATEGORY_DATASET_PATH: + # Local dataset: the per-task corpus is git-ignored and must be + # regenerated from the vendored copy before enumeration can see + # any task.toml files, mirroring the leaf's own populate step. + dataset_path = CATEGORY_DATASET_PATH[category] + subprocess.run( + [ + "uv", "run", "python", "-m", + "harbor_adapters.contextbench.main", + "--populate", dataset_path, + ], + check=True, + ) + env["ENUM_DATASET_PATH"] = dataset_path + env.pop("ENUM_DATASET", None) + else: + env["ENUM_DATASET"] = CATEGORY_DATASET[category] + env.pop("ENUM_DATASET_PATH", None) + result = subprocess.run( + ["uv", "run", "python", enumerate_script], + env=env, + capture_output=True, + text=True, + check=True, + ) + names = [line for line in result.stdout.splitlines() if line.strip()] + if not names: + sys.exit(f"::error::Enumerated 0 tasks for category {category!r}") + tasks_by_cat[category] = names - eval-openai: - needs: prep - if: needs.prep.outputs.openai_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.openai_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + out_path = os.path.join(os.environ["RUNNER_TEMP"], "tasks.json") + with open(out_path, "w") as f: + json.dump(tasks_by_cat, f) - eval-openrouter: - needs: prep - if: needs.prep.outputs.openrouter_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.openrouter_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + with open(os.environ["GITHUB_ENV"], "a") as f: + f.write(f"UNIFIED_TASKS_JSON={out_path}\n") + PY - eval-xai: - needs: prep - if: needs.prep.outputs.xai_has_models == 'true' - strategy: - fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.xai_matrix) }} - uses: ./.github/workflows/_harbor_run.yml - secrets: inherit - with: - model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} - rollouts: ${{ inputs.rollouts }} - concurrency: ${{ inputs.concurrency }} - sandbox_env: ${{ inputs.sandbox_env }} - force_build: ${{ inputs.force_build }} - harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} + - name: "🧮 Parse models + build the per-model flat matrix" + id: p + env: + UNIFIED_MODELS: ${{ inputs.models }} + UNIFIED_CATEGORIES: ${{ inputs.categories }} + UNIFIED_AGENT_IMPL: ${{ inputs.agent_impl }} + UNIFIED_PROFILE: ${{ inputs.profile }} + UNIFIED_CONCURRENCY: ${{ inputs.concurrency }} + UNIFIED_ROLLOUTS: ${{ inputs.rollouts }} + # Set by the enumerate step above for the full profile only; empty + # (unset) for lite, which unified_prep.py never reads in that case. + UNIFIED_TASKS_JSON: ${{ env.UNIFIED_TASKS_JSON }} + run: python .github/scripts/unified_prep.py - eval-other: + eval: + name: "🚀 Evaluate (${{ matrix.model }})" needs: prep - if: needs.prep.outputs.other_has_models == 'true' strategy: fail-fast: false - max-parallel: 1 - matrix: ${{ fromJson(needs.prep.outputs.other_matrix) }} + # Caps how many models run concurrently so total runners across every + # model's own shard pool stay within the global runner budget (see + # unified_prep.py's derive_pool). + max-parallel: ${{ fromJson(needs.prep.outputs.model_parallel) }} + matrix: ${{ fromJson(needs.prep.outputs.eval_matrix) }} uses: ./.github/workflows/_harbor_run.yml secrets: inherit with: model: ${{ matrix.model }} - category: ${{ matrix.category }} - dataset: ${{ matrix.dataset }} - dataset_path: ${{ matrix.dataset_path }} - agent_impl: ${{ matrix.agent_impl }} - langsmith_dataset: ${{ matrix.langsmith_dataset }} - n_shards: ${{ matrix.n_shards }} - shard_parallel: ${{ matrix.shard_parallel }} + # The model's full multi-category, multi-shard matrix, pre-serialized by + # unified_prep.py. _harbor_run.yml's own harbor job matrixes over these + # entries directly instead of expanding a single-dataset shard axis. + flat_matrix: ${{ matrix.flat_matrix }} + max_parallel: ${{ needs.prep.outputs.max_parallel }} + # Fallbacks only: every flat_matrix entry carries its own category, + # dataset, dataset_path, agent_impl, and include_tasks. + category: "" + dataset: "" + dataset_path: "" + agent_impl: ${{ inputs.agent_impl }} rollouts: ${{ inputs.rollouts }} concurrency: ${{ inputs.concurrency }} sandbox_env: ${{ inputs.sandbox_env }} force_build: ${{ inputs.force_build }} harbor_package_override: ${{ inputs.harbor_package_override }} - include_tasks: ${{ matrix.include_tasks }} combine: name: "📊 Combine cross-model results" needs: - prep - - eval-anthropic - - eval-baseten - - eval-fireworks - - eval-google_genai - - eval-groq - - eval-nvidia - - eval-ollama - - eval-openai - - eval-openrouter - - eval-xai - - eval-other + - eval if: ${{ always() }} runs-on: ubuntu-latest # Every ref publishes to the same branch. Serialize the publishing jobs so From 84fcff9c378871090564accc61d5d215e83be1f9 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 16:42:52 -0400 Subject: [PATCH 31/48] fix(evals): source enumerate dataset mapping from CATEGORY_MAP to prevent drift The enumerate step in unified_evals.yml hardcoded per-category dataset refs that duplicated unified_prep.CATEGORY_MAP, with a comment falsely claiming a test pinned the two together. Import CATEGORY_MAP directly instead so the mapping has one source of truth and can't silently drift. --- .github/workflows/unified_evals.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unified_evals.yml b/.github/workflows/unified_evals.yml index 08c3058b6cf..03b4b8bcffd 100644 --- a/.github/workflows/unified_evals.yml +++ b/.github/workflows/unified_evals.yml @@ -99,18 +99,16 @@ jobs: import subprocess import sys - # Category -> dataset mapping mirrors unified_prep.py's CATEGORY_MAP. - # Kept as separate constants here (rather than importing that - # module) since this step runs before unified_prep.py's own - # validation; the two are pinned together by test_unified_workflow.py. - CATEGORY_DATASET = { - "autonomous": "harbor-index/harbor-index-1.0", - "conversation": "tau3-subset", - } - CATEGORY_DATASET_PATH = { - "context": "datasets/context-retrieval-evals", - } - KNOWN_CATEGORIES = set(CATEGORY_DATASET) | set(CATEGORY_DATASET_PATH) + # Resolve dataset refs straight from unified_prep.py's CATEGORY_MAP + # (the same module the flat-matrix step below imports) so there is + # a single source of truth for category -> dataset and a version + # bump there can't silently drift out of sync with enumeration. + sys.path.insert( + 0, os.path.join(os.environ["GITHUB_WORKSPACE"], ".github", "scripts") + ) + from unified_prep import CATEGORY_MAP + + KNOWN_CATEGORIES = set(CATEGORY_MAP) raw = os.environ.get("UNIFIED_CATEGORIES", "") categories = list(dict.fromkeys(c.strip() for c in raw.split(",") if c.strip())) @@ -125,12 +123,13 @@ jobs: ) tasks_by_cat: dict[str, list[str]] = {} for category in categories: + dataset = CATEGORY_MAP[category]["dataset"] + dataset_path = CATEGORY_MAP[category]["dataset_path"] env = os.environ.copy() - if category in CATEGORY_DATASET_PATH: + if dataset_path: # Local dataset: the per-task corpus is git-ignored and must be # regenerated from the vendored copy before enumeration can see # any task.toml files, mirroring the leaf's own populate step. - dataset_path = CATEGORY_DATASET_PATH[category] subprocess.run( [ "uv", "run", "python", "-m", @@ -142,7 +141,7 @@ jobs: env["ENUM_DATASET_PATH"] = dataset_path env.pop("ENUM_DATASET", None) else: - env["ENUM_DATASET"] = CATEGORY_DATASET[category] + env["ENUM_DATASET"] = dataset env.pop("ENUM_DATASET_PATH", None) result = subprocess.run( ["uv", "run", "python", enumerate_script], From 922026540f93a12c2c2a124a0ad34528a0a2b005 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 16:54:16 -0400 Subject: [PATCH 32/48] feat(evals): decouple shard_parallel from n_shards for dynamic dispatch --- .../scripts/test_validate_harbor_limits.py | 105 +++++++++++++++--- .github/scripts/validate_harbor_limits.py | 76 +++++++++++-- .github/workflows/harbor.yml | 19 +++- 3 files changed, 172 insertions(+), 28 deletions(-) diff --git a/.github/scripts/test_validate_harbor_limits.py b/.github/scripts/test_validate_harbor_limits.py index cfbcc4a057b..2c7fd594952 100644 --- a/.github/scripts/test_validate_harbor_limits.py +++ b/.github/scripts/test_validate_harbor_limits.py @@ -15,12 +15,13 @@ REPO_ROOT = Path(__file__).resolve().parents[2] SCRIPT = REPO_ROOT / ".github" / "scripts" / "validate_harbor_limits.py" +UNIFIED_PREP_SCRIPT = REPO_ROOT / ".github" / "scripts" / "unified_prep.py" -def _load() -> ModuleType: - spec = importlib.util.spec_from_file_location("gha_validate_harbor_limits", SCRIPT) +def _load(path: Path, name: str) -> ModuleType: + spec = importlib.util.spec_from_file_location(name, path) if spec is None or spec.loader is None: - msg = f"Could not load module spec for {SCRIPT}" + msg = f"Could not load module spec for {path}" raise AssertionError(msg) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) @@ -29,7 +30,12 @@ def _load() -> ModuleType: @pytest.fixture(scope="module") def mod() -> ModuleType: - return _load() + return _load(SCRIPT, "gha_validate_harbor_limits") + + +@pytest.fixture(scope="module") +def unified_prep() -> ModuleType: + return _load(UNIFIED_PREP_SCRIPT, "gha_unified_prep") def _one_model(name: str = "openai:gpt-5.4") -> list[dict]: @@ -37,34 +43,39 @@ def _one_model(name: str = "openai:gpt-5.4") -> list[dict]: def test_single_model_at_caps_is_valid(mod: ModuleType) -> None: - """One model, n_shards == 10, concurrency == 4 (the documented maximum) passes.""" - assert mod.validate_limits(_one_model(), mod.MAX_SHARDS, mod.MAX_CONCURRENCY) == [] + """One model, n_shards at the shard cap, concurrency at its own cap, passes.""" + assert ( + mod.validate_limits( + _one_model(), mod.shard_matrix.MAX_SHARDS, mod.MAX_CONCURRENCY, 1 + ) + == [] + ) def test_zero_models_rejected(mod: ModuleType) -> None: - errors = mod.validate_limits([], 1, 1) + errors = mod.validate_limits([], 1, 1, 1) assert any("single model" in e for e in errors) def test_two_models_rejected_and_names_reported(mod: ModuleType) -> None: models = [{"model": "openai:gpt-5.4"}, {"model": "anthropic:claude-sonnet-4-6"}] - errors = mod.validate_limits(models, 1, 1) + errors = mod.validate_limits(models, 1, 1, 1) assert any("single model" in e for e in errors) # The offending model names are surfaced so the failure is self-diagnosing. assert any("anthropic:claude-sonnet-4-6" in e for e in errors) def test_n_shards_over_cap_rejected(mod: ModuleType) -> None: - errors = mod.validate_limits(_one_model(), mod.MAX_SHARDS + 1, 1) + errors = mod.validate_limits(_one_model(), mod.shard_matrix.MAX_SHARDS + 1, 1, 1) assert any("n_shards" in e for e in errors) - # Boundary: exactly the cap is allowed. - assert mod.validate_limits(_one_model(), mod.MAX_SHARDS, 1) == [] + # Boundary: exactly the cap (200, from shard_matrix.MAX_SHARDS) is allowed. + assert mod.validate_limits(_one_model(), mod.shard_matrix.MAX_SHARDS, 1, 1) == [] def test_concurrency_over_cap_rejected(mod: ModuleType) -> None: - errors = mod.validate_limits(_one_model(), 1, mod.MAX_CONCURRENCY + 1) + errors = mod.validate_limits(_one_model(), 1, mod.MAX_CONCURRENCY + 1, 1) assert any("concurrency" in e for e in errors) - assert mod.validate_limits(_one_model(), 1, mod.MAX_CONCURRENCY) == [] + assert mod.validate_limits(_one_model(), 1, mod.MAX_CONCURRENCY, 1) == [] @pytest.mark.parametrize("bad", ["0", "-1", "abc", "", " ", "1.5"]) @@ -77,6 +88,53 @@ def test_parse_positive_accepts_valid(mod: ModuleType) -> None: assert mod.parse_positive("n_shards", " 7 ") == 7 +def test_derive_shard_parallel_saturates_pool_and_clamps_to_n_shards( + mod: ModuleType, +) -> None: + # per_shard = min(4, 3) = 3; 40 // 3 = 13, well under n_shards=100. + assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=100) == 13 + # Same concurrency/rollouts, but n_shards=5 clamps the pool down to 5. + assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=5) == 5 + # per_shard = min(1, 3) = 1; 40 // 1 = 40, the full budget. + assert mod.derive_shard_parallel(concurrency=1, rollouts=3, n_shards=100) == 40 + + +def test_derive_shard_parallel_unchanged_at_todays_n_shards_10(mod: ModuleType) -> None: + """No-change property: at n_shards=10 with today's typical inputs, the + derived shard_parallel equals n_shards itself — identical to the current + (undifferentiated) behavior of passing n_shards straight through. + """ + assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=10) == 10 + assert mod.derive_shard_parallel(concurrency=4, rollouts=4, n_shards=10) == 10 + + +@pytest.mark.parametrize( + ("concurrency", "rollouts", "n_shards"), + [ + (4, 3, 100), + (4, 3, 10), + (4, 4, 10), + (1, 3, 100), + (4, 2, 100), + (1, 3, 8), + (4, 3, 5), + (2, 5, 34), + ], +) +def test_derive_shard_parallel_matches_unified_prep_derive_pool( + mod: ModuleType, + unified_prep: ModuleType, + concurrency: int, + rollouts: int, + n_shards: int, +) -> None: + """Drift guard: pins this module's derivation to unified_prep.derive_pool's + single-model max_parallel so the two formulas can't silently diverge. + """ + expected = unified_prep.derive_pool(concurrency, rollouts, n_shards, 1)[0] + assert mod.derive_shard_parallel(concurrency, rollouts, n_shards) == expected + + def test_main_exits_nonzero_on_multiple_models( mod: ModuleType, monkeypatch: pytest.MonkeyPatch ) -> None: @@ -84,6 +142,7 @@ def test_main_exits_nonzero_on_multiple_models( monkeypatch.setenv("MODEL_MATRIX", json.dumps(matrix)) monkeypatch.setenv("N_SHARDS", "10") monkeypatch.setenv("CONCURRENCY", "4") + monkeypatch.setenv("ROLLOUTS", "3") with pytest.raises(SystemExit) as exc: mod.main() assert exc.value.code not in (0, None) @@ -95,16 +154,34 @@ def test_main_exits_nonzero_on_bad_shards( monkeypatch.setenv("MODEL_MATRIX", json.dumps({"include": [{"model": "a:1"}]})) monkeypatch.setenv("N_SHARDS", "0") monkeypatch.setenv("CONCURRENCY", "4") + monkeypatch.setenv("ROLLOUTS", "3") with pytest.raises(SystemExit) as exc: mod.main() assert exc.value.code not in (0, None) -def test_main_succeeds_for_valid_single_model( +def test_main_exits_nonzero_on_bad_rollouts( mod: ModuleType, monkeypatch: pytest.MonkeyPatch ) -> None: monkeypatch.setenv("MODEL_MATRIX", json.dumps({"include": [{"model": "a:1"}]})) monkeypatch.setenv("N_SHARDS", "10") monkeypatch.setenv("CONCURRENCY", "4") + monkeypatch.setenv("ROLLOUTS", "0") + with pytest.raises(SystemExit) as exc: + mod.main() + assert exc.value.code not in (0, None) + + +def test_main_succeeds_for_valid_single_model( + mod: ModuleType, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + monkeypatch.setenv("MODEL_MATRIX", json.dumps({"include": [{"model": "a:1"}]})) + monkeypatch.setenv("N_SHARDS", "10") + monkeypatch.setenv("CONCURRENCY", "4") + monkeypatch.setenv("ROLLOUTS", "3") + github_output = tmp_path / "github_output.txt" + monkeypatch.setenv("GITHUB_OUTPUT", str(github_output)) # No SystemExit == success. mod.main() + # The derived shard_parallel is emitted for harbor.yml to consume. + assert "shard_parallel=10" in github_output.read_text() diff --git a/.github/scripts/validate_harbor_limits.py b/.github/scripts/validate_harbor_limits.py index 8515f6ed569..13bd65af7e6 100644 --- a/.github/scripts/validate_harbor_limits.py +++ b/.github/scripts/validate_harbor_limits.py @@ -6,9 +6,19 @@ * the resolved model set is not a single model (a model group like `all`/`set0` or a comma-separated `models_override` resolves to more than one), or -* the per-run limits are exceeded: `n_shards <= 10`, `concurrency <= 4`. With a - single model their product bounds concurrent sandboxes to `10 * 4 = 40`; the - caps are checked independently (there is no separate product check). +* the per-run limits are exceeded: `n_shards <= shard_matrix.MAX_SHARDS` (200), + `concurrency <= 4`. `n_shards` no longer bounds concurrency directly — it may + be set as high as the task count (one task per shard) for dynamic dispatch. + Instead, the derived `shard_parallel` (the pool the shards drain through) is + what's bounded, alongside the per-shard concurrent-trial count: `shard_parallel + * min(concurrency, rollouts) <= 40`. + +This module owns the derivation of `shard_parallel` for the single-model case: +`shard_parallel = min(MAX_TASKS_PER_MODEL // min(concurrency, rollouts), +n_shards)`, mirroring `unified_prep.derive_pool` (pinned together by +`test_validate_harbor_limits.py`'s drift-guard test). `main()` emits it as +`shard_parallel=` to `$GITHUB_OUTPUT` for `harbor.yml` to pass straight +through to the leaf workflow's `shard_parallel` input. Mirrors `.github/scripts/shard_matrix.py` (import-by-path, stdlib only) so it is exercised by `test_validate_harbor_limits.py` under CI's @@ -22,8 +32,13 @@ import os import sys -MAX_SHARDS = 10 +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import shard_matrix # noqa: E402 (shard_matrix.py in same dir) + MAX_CONCURRENCY = 4 +# Per-model concurrent-sandbox budget the derived shard_parallel must respect +# alongside concurrency (mirrors unified_prep.MAX_TASKS_PER_MODEL). +MAX_TASKS_PER_MODEL = 40 class LimitError(Exception): @@ -42,7 +57,22 @@ def parse_positive(name: str, raw: str | None) -> int: return int(text) -def validate_limits(models: list, n_shards: int, concurrency: int) -> list[str]: +def derive_shard_parallel(concurrency: int, rollouts: int, n_shards: int) -> int: + """Derive the shard pool size the run job's shards drain through. + + Mirrors `unified_prep.derive_pool`'s `max_parallel` for a single model: + `per_shard = min(concurrency, rollouts)` is the peak concurrent trials one + 1-task shard ever runs; the pool saturates the per-model + `MAX_TASKS_PER_MODEL` (40) budget without exceeding `n_shards` itself (no + point pooling more than there are shards to drain). + """ + per_shard = max(1, min(concurrency, rollouts)) + return max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + + +def validate_limits( + models: list, n_shards: int, concurrency: int, rollouts: int +) -> list[str]: """Return a list of human-readable violations (empty when the run is valid).""" errors: list[str] = [] if len(models) != 1: @@ -52,10 +82,28 @@ def validate_limits(models: list, n_shards: int, concurrency: int) -> list[str]: f"to {len(models)}: {names}. Pick exactly one model — model groups " "(all/set0/frontier/...) and comma-separated overrides are not accepted." ) - if n_shards > MAX_SHARDS: - errors.append(f"n_shards={n_shards} exceeds the cap of {MAX_SHARDS}") + if n_shards > shard_matrix.MAX_SHARDS: + errors.append(f"n_shards={n_shards} exceeds the cap of {shard_matrix.MAX_SHARDS}") if concurrency > MAX_CONCURRENCY: errors.append(f"concurrency={concurrency} exceeds the cap of {MAX_CONCURRENCY}") + + # Defensive, not user-facing: derive_shard_parallel's floor division makes + # this true by construction (never trips). Uses per_shard — the peak + # concurrent trials one 1-task shard actually runs, min(concurrency, + # rollouts) — rather than raw concurrency, since a shard with fewer + # rollouts than its concurrency setting can't use the extra slots (same + # per_shard substitution unified_prep.derive_pool's docstring describes + # loosely as "concurrency"). An explicit raise (never a bare `assert`, + # which `python -O` strips) so a formula regression fails loudly instead + # of silently over-provisioning sandboxes. + shard_parallel = derive_shard_parallel(concurrency, rollouts, n_shards) + per_shard = max(1, min(concurrency, rollouts)) + if shard_parallel * per_shard > MAX_TASKS_PER_MODEL: + msg = ( + f"internal error: derived shard_parallel={shard_parallel} * " + f"per_shard={per_shard} exceeds {MAX_TASKS_PER_MODEL}" + ) + raise AssertionError(msg) return errors @@ -65,19 +113,29 @@ def main() -> None: models = json.loads(os.environ["MODEL_MATRIX"]).get("include", []) n_shards = parse_positive("n_shards", os.environ.get("N_SHARDS")) concurrency = parse_positive("concurrency", os.environ.get("CONCURRENCY")) + rollouts = parse_positive("rollouts", os.environ.get("ROLLOUTS")) except LimitError as exc: print(f"::error::{exc}") # noqa: T201 sys.exit(1) - errors = validate_limits(models, n_shards, concurrency) + errors = validate_limits(models, n_shards, concurrency, rollouts) for err in errors: print(f"::error::{err}") # noqa: T201 if errors: sys.exit(1) + + shard_parallel = derive_shard_parallel(concurrency, rollouts, n_shards) print( # noqa: T201 f"OK: single model ({models[0].get('model')}), n_shards={n_shards} " - f"(<= {MAX_SHARDS}), concurrency={concurrency} (<= {MAX_CONCURRENCY})" + f"(<= {shard_matrix.MAX_SHARDS}), concurrency={concurrency} " + f"(<= {MAX_CONCURRENCY}), derived shard_parallel={shard_parallel}" ) + github_output = os.environ.get("GITHUB_OUTPUT") + if github_output: + with open(github_output, "a") as f: # noqa: PTH123 + f.write(f"shard_parallel={shard_parallel}\n") + else: + print(f"shard_parallel={shard_parallel}") # noqa: T201 if __name__ == "__main__": diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 6fc53b4dc68..186087e6702 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -184,7 +184,7 @@ on: default: false type: boolean n_shards: - description: "Split the dataset's tasks across N parallel shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). Capped at 10 (with concurrency capped at 4 and a single model, at most 40 concurrent sandboxes)." + description: "Split the dataset's tasks across N shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). May be set as high as the task count (one task per shard) for dynamic dispatch — shards drain through a derived pool (shard_parallel), not all at once. Capped at 200 (shard_matrix.MAX_SHARDS); the pool is bounded so shard_parallel * min(concurrency, rollouts_per_task) <= 40 concurrent sandboxes." required: false default: "10" type: string @@ -220,6 +220,9 @@ jobs: # Eval category derived from the dataset inputs, consumed by the leaf # workflow's unified reporting (autonomous | conversation | context). category: ${{ steps.category.outputs.category }} + # Derived shard pool (dynamic dispatch) from the "🔒 Validate single + # model + resource limits" step, for the run job's shard_parallel input. + shard_parallel: ${{ steps.limits.outputs.shard_parallel }} env: LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} steps: @@ -274,13 +277,18 @@ jobs: - name: "🔒 Validate single model + resource limits" # This workflow evaluates exactly ONE model. Fail fast (before the matrix # fans out) if the resolved model set is not a single model, or if the - # per-run limits are exceeded (n_shards <= 10, concurrency <= 4; with one - # model their product bounds concurrent sandboxes to 40). Inputs are read + # per-run limits are exceeded (n_shards <= shard_matrix.MAX_SHARDS=200, + # concurrency <= 4). n_shards may be set high for dynamic dispatch (one + # task per shard); shards drain through a derived shard_parallel pool + # instead of all running at once, bounded so shard_parallel * + # min(concurrency, rollouts) <= 40 concurrent sandboxes. Inputs are read # via env (no shell interpolation) and int-parsed in the script. # See validate_harbor_limits.py (unit-tested in test_validate_harbor_limits.py). + id: limits env: N_SHARDS: ${{ inputs.n_shards || '10' }} CONCURRENCY: ${{ inputs.concurrency || '4' }} + ROLLOUTS: ${{ inputs.rollouts_per_task }} MODEL_MATRIX: ${{ steps.set-matrix.outputs.matrix }} run: python .github/scripts/validate_harbor_limits.py @@ -329,8 +337,9 @@ jobs: langsmith_dataset: "" rollouts: ${{ inputs.rollouts_per_task }} n_shards: ${{ inputs.n_shards }} - # Run every shard in parallel (cap = n_shards). - shard_parallel: ${{ inputs.n_shards }} + # Derived pool the shards drain through (dynamic dispatch), not n_shards + # itself — see the prep job's "🔒 Validate single model + resource limits" step. + shard_parallel: ${{ needs.prep.outputs.shard_parallel }} concurrency: ${{ inputs.concurrency }} sandbox_env: ${{ inputs.sandbox_env }} n_retries: ${{ inputs.n_retries }} From 01be605c9fa70c39b57b5e1b6156471fe8cb0b2a Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 17:10:54 -0400 Subject: [PATCH 33/48] fix(evals): bound per-model flat matrix to MAX_SHARDS via proportional packing build_flat_matrix packed each category to MAX_SHARDS independently, so a model's per-category task counts could sum past GitHub's 256-job matrix cap even though each category looked fine on its own. Allocate a MAX_SHARDS shard budget across active categories proportional to their task counts (_allocate_shard_budgets), then pack each category to its own budget, so the per-model total is always bounded. Also rewords two temporal comments to state current behavior and drops a redundant paren nesting. --- .github/scripts/test_unified_prep.py | 34 +++++++++++++++ .github/scripts/unified_prep.py | 51 ++++++++++++++++++++--- .github/scripts/validate_harbor_limits.py | 2 +- .github/workflows/_harbor_run.yml | 5 +-- 4 files changed, 82 insertions(+), 10 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 0d1f871d617..bb0558a833b 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -169,6 +169,40 @@ def test_build_flat_matrix_packs_above_cap(): assert seen == tasks["autonomous"] +def test_build_flat_matrix_bounds_per_model_total_across_categories(): + # 120 + 120 + 40 = 280 > MAX_SHARDS (200): the per-model TOTAL must be + # packed down to the cap via proportional per-category budgets, not just + # each category independently capped (which would allow up to 3x200). + tasks = { + "autonomous": [f"harbor-index/a{i}" for i in range(120)], + "conversation": [f"sierra-research/tau3-bench__c{i}" for i in range(120)], + "context": [f"cb-cloud-{i}" for i in range(40)], + } + entries = up.build_flat_matrix( + "openai:gpt", ["autonomous", "conversation", "context"], tasks, dcode_impl="dcode" + ) + assert len(entries) <= shard_matrix.MAX_SHARDS + for cat, expected in tasks.items(): + cat_entries = [e for e in entries if e["category"] == cat] + seen = " ".join(e["include_tasks"] for e in cat_entries).split() + assert seen == expected # every task present exactly once, order preserved + + +def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): + # Lite-like: total is well under MAX_SHARDS, so behavior is unchanged — + # one task per matrix entry, no packing. + tasks = { + "autonomous": [f"harbor-index/a{i}" for i in range(15)], + "conversation": [f"sierra-research/tau3-bench__c{i}" for i in range(11)], + "context": [f"cb-cloud-{i}" for i in range(8)], + } + entries = up.build_flat_matrix( + "openai:gpt", ["autonomous", "conversation", "context"], tasks, dcode_impl="dcode" + ) + assert len(entries) == 15 + 11 + 8 + assert all(len(e["include_tasks"].split()) == 1 for e in entries) + + def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): import json as _j out = tmp_path / "o" diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index c2a1f404ab1..d4715d47f06 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -147,6 +147,28 @@ def derive_pool( return max_parallel, model_parallel +def _allocate_shard_budgets(counts: dict[str, int], cap: int) -> dict[str, int]: + """Split `cap` shards across categories proportional to `counts`. + + Each category gets `max(1, cap * count // total)` shards. That floor + allocation can round up to more than `cap` in total when several small + categories each get bumped to the 1-shard floor, so any resulting excess is + trimmed one shard at a time from the currently-largest budget (ties broken + by category order) until the sum is exactly `<= cap`. + """ + total = sum(counts.values()) + budgets = {cat: max(1, (cap * n) // total) for cat, n in counts.items()} + excess = sum(budgets.values()) - cap + while excess > 0: + shrinkable = [cat for cat, b in budgets.items() if b > 1] + if not shrinkable: + break + largest = max(shrinkable, key=lambda cat: budgets[cat]) + budgets[largest] -= 1 + excess -= 1 + return budgets + + def build_flat_matrix( model: str, categories: list[str], @@ -155,17 +177,34 @@ def build_flat_matrix( ) -> list[dict]: """One flat matrix of single-`harbor run` shards spanning all categories. - Each category's task list is packed into <= MAX_SHARDS groups (1 task each - below the cap); each group is one matrix entry carrying its own dataset and - agent so the leaf's max-parallel pool drains the mixed queue across category - boundaries. `provider` is retained only as an aggregation tag. + Each category's task list is packed into a per-category shard budget; each + group is one matrix entry carrying its own dataset and agent so the leaf's + max-parallel pool drains the mixed queue across category boundaries. + `provider` is retained only as an aggregation tag. + + The per-model total entry count is bounded by `shard_matrix.MAX_SHARDS`: + when the categories' combined task count fits under the cap, each category + packs 1 task/shard as usual. Above the cap, `MAX_SHARDS` is allocated across + the active categories proportional to their task counts (via + `_allocate_shard_budgets`) and each category is packed into its own budget, + so the sum across categories never exceeds `MAX_SHARDS`. """ prov = provider_of(model) + active_counts = { + cat: len(tasks_by_cat[cat]) for cat in categories if tasks_by_cat.get(cat) + } + total = sum(active_counts.values()) + if total > shard_matrix.MAX_SHARDS: + budgets = _allocate_shard_budgets(active_counts, shard_matrix.MAX_SHARDS) + else: + budgets = dict.fromkeys(active_counts, shard_matrix.MAX_SHARDS) + entries: list[dict] = [] for cat in categories: cm = CATEGORY_MAP[cat] agent_impl = dcode_impl if cm["agent_impl"] == "dcode" else cm["agent_impl"] - for group in shard_matrix.pack_tasks(tasks_by_cat.get(cat, [])): + cat_budget = budgets.get(cat, shard_matrix.MAX_SHARDS) + for group in shard_matrix.pack_tasks(tasks_by_cat.get(cat, []), cat_budget): entries.append( { "model": model, @@ -256,7 +295,7 @@ def main(argv: list[str] | None = None) -> int: tasks_by_cat = json.load(f) n_models = len(model_specs) - est_tasks = max((sum(len(tasks_by_cat.get(c, [])) for c in categories), 1)) + est_tasks = max(sum(len(tasks_by_cat.get(c, [])) for c in categories), 1) total_job_guard(n_models, est_tasks) # n_shards for the pool = number of single-task shards (pre-pack); derive pool. diff --git a/.github/scripts/validate_harbor_limits.py b/.github/scripts/validate_harbor_limits.py index 13bd65af7e6..b5dc605d535 100644 --- a/.github/scripts/validate_harbor_limits.py +++ b/.github/scripts/validate_harbor_limits.py @@ -7,7 +7,7 @@ * the resolved model set is not a single model (a model group like `all`/`set0` or a comma-separated `models_override` resolves to more than one), or * the per-run limits are exceeded: `n_shards <= shard_matrix.MAX_SHARDS` (200), - `concurrency <= 4`. `n_shards` no longer bounds concurrency directly — it may + `concurrency <= 4`. `n_shards` does not bound concurrency directly — it may be set as high as the task count (one task per shard) for dynamic dispatch. Instead, the derived `shard_parallel` (the pool the shards drain through) is what's bounded, alongside the per-shard concurrent-trial count: `shard_parallel diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 5141e34730e..2b60355fc38 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -41,7 +41,7 @@ on: max_parallel: # Explicit size of the harbor job's parallel runner pool, for a caller # driving `flat_matrix` across several models/categories at once. 0 - # falls back to `shard_parallel` (today's single-dataset behavior). + # falls back to `shard_parallel`, the single-dataset pool size. type: string default: "0" concurrency: @@ -107,8 +107,7 @@ jobs: # The harbor job reads this so its partition matches the emitted matrix. n_shards: ${{ steps.resolve-matrix.outputs.n_shards }} # Size of the harbor job's parallel runner pool: an explicit max_parallel - # override when the caller supplied one, else the per-leaf shard_parallel - # (today's behavior). + # override when the caller supplied one, else the per-leaf shard_parallel. effective_max_parallel: ${{ steps.resolve-matrix.outputs.effective_max_parallel }} # One entry per category to aggregate: a single entry for the plain # single-dataset call, or (on a flat multi-category run) one entry per From 375b3f2adb1cac6bca143cf4f7cae440fe399eda Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 18:01:29 -0400 Subject: [PATCH 34/48] fix(evals): populate corpus + forward judge key on the flat per-shard path The flat pool passes dataset_path/dataset empty at the leaf input level (real values are per-shard in matrix.*). Re-point the local-corpus populate step to matrix.dataset_path so context shards regenerate their files/ before the docker build, and always forward OPENAI_API_KEY since the verifier judge is always an OpenAI model regardless of the model under test. --- .github/workflows/_harbor_run.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 2b60355fc38..44290524887 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -293,7 +293,9 @@ jobs: LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} - OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} + # The verifier's judge is always an OpenAI model (JUDGE_PROVIDER=openai), + # so this key is required regardless of the model under test. + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENROUTER_API_KEY: ${{ startsWith(matrix.model, 'openrouter:') && secrets.OPENROUTER_API_KEY || '' }} XAI_API_KEY: ${{ startsWith(matrix.model, 'xai:') && secrets.XAI_API_KEY || '' }} run: | @@ -432,10 +434,10 @@ jobs: "$GITHUB_WORKSPACE/libs/evals/deepagents_harbor/langgraph_project/langgraph.json" - name: "🗂️ Populate local dataset corpus" - if: ${{ inputs.dataset_path != '' }} + if: ${{ (matrix.dataset_path || inputs.dataset_path) != '' }} working-directory: libs/evals env: - HARBOR_DATASET_PATH: ${{ inputs.dataset_path }} + HARBOR_DATASET_PATH: ${{ matrix.dataset_path || inputs.dataset_path }} # The per-task corpus is single-sourced (git-ignored) and regenerated from # the vendored copy so each task's build context has its files/ before # Harbor builds the task images. @@ -455,7 +457,9 @@ jobs: LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }} NVIDIA_API_KEY: ${{ startsWith(matrix.model, 'nvidia:') && secrets.NVIDIA_API_KEY || '' }} OLLAMA_API_KEY: ${{ startsWith(matrix.model, 'ollama:') && secrets.OLLAMA_API_KEY || '' }} - OPENAI_API_KEY: ${{ (startsWith(matrix.model, 'openai:') || contains(inputs.dataset, 'tau3') || contains(inputs.dataset, 'harbor-index')) && secrets.OPENAI_API_KEY || '' }} + # The verifier's judge is always an OpenAI model (JUDGE_PROVIDER=openai), + # so this key is required regardless of the model under test. + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OPENROUTER_API_KEY: ${{ startsWith(matrix.model, 'openrouter:') && secrets.OPENROUTER_API_KEY || '' }} XAI_API_KEY: ${{ startsWith(matrix.model, 'xai:') && secrets.XAI_API_KEY || '' }} run: | From 60623849204f2c84d36753299ce0d5c82d55a3e0 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Tue, 14 Jul 2026 19:14:38 -0400 Subject: [PATCH 35/48] fix(evals): scope LangSmith experiment name by category A model spans three category datasets, but the experiment name was per-model only, so one experiment attached across datasets and LangSmith double-counted runs. Include the category slug so each category's dataset gets its own experiment; shards within a category still share the name and converge into one session. --- .github/workflows/_harbor_run.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index 44290524887..f76dce9c319 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -713,17 +713,20 @@ jobs: esac experiment_model=$(printf '%s' "$HARBOR_MODEL" | tr '/:' '--' | tr -c '[:alnum:]._-' '-') experiment_agent=$(printf '%s' "$HARBOR_AGENT_IMPL" | tr -c '[:alnum:]._-' '-') + experiment_category=$(printf '%s' "$HARBOR_CATEGORY" | tr -c '[:alnum:]._-' '-') # Precedence: explicit override > tau3-subset name hook > the value # resolved above (local-path-aware `local/...` or the registry ref). # The override uses a dedicated var the tau3 step never writes, so it # can't be clobbered. HARBOR_LANGSMITH_DATASET="${HARBOR_LS_DATASET_OVERRIDE:-${HARBOR_LANGSMITH_DATASET_NAME:-$HARBOR_LANGSMITH_DATASET}}" - # Include the run id + attempt so all shards of this dispatch share one - # experiment name (Harbor's LangSmith plugin uses an explicit name - # verbatim and create-or-reuses it, converging the shards) while a - # later dispatch or re-run gets its own experiment. HARBOR_LANGSMITH_DATASET + # Scope the experiment name by category so each category's dataset gets + # its own experiment: one model spans three datasets, and a single + # experiment name shared across them double-counts runs in LangSmith. + # Shards within a category still share this name, so Harbor's LangSmith + # plugin reuses one session per category and converges them; the run id + + # attempt keep a later dispatch or re-run separate. HARBOR_LANGSMITH_DATASET # is already set (local-path-aware) in the dataset-resolution block above. - HARBOR_LANGSMITH_EXPERIMENT="deepagents-harbor-${experiment_agent}-${experiment_model}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + HARBOR_LANGSMITH_EXPERIMENT="deepagents-harbor-${experiment_agent}-${experiment_model}${experiment_category:+-$experiment_category}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" echo "HARBOR_AGENT_GRAPH=$HARBOR_AGENT_GRAPH" >> "$GITHUB_ENV" echo "HARBOR_AGENT_LABEL=$HARBOR_AGENT_LABEL" >> "$GITHUB_ENV" echo "HARBOR_LANGSMITH_DATASET=$HARBOR_LANGSMITH_DATASET" >> "$GITHUB_ENV" From be0f26b872fd9e977d17a6796e1d973b4f73a121 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 10:18:05 -0400 Subject: [PATCH 36/48] fix(evals): align tau3 preflight test with unconditional OpenAI key The flat-pool refactor made _harbor_run.yml provide OPENAI_API_KEY unconditionally (the tau3 verifier/judge is always an OpenAI model), replacing the old contains(inputs.dataset, 'tau3') gate that is wrong in a flat pool where matrix.dataset, not inputs.dataset, carries the shard's dataset. Assert the new wiring instead of the removed expression. --- .../tests/unit_tests/test_harbor_langsmith_integration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py b/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py index 038a4a301ae..0a409ff86d2 100644 --- a/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py +++ b/libs/evals/tests/unit_tests/test_harbor_langsmith_integration.py @@ -244,9 +244,10 @@ def test_harbor_workflow_wires_tau3_subset() -> None: # The resolve step must fail loudly on a wrong-sized filter (empty => full # dataset), so the count tripwire must stay wired. assert 'if [ "$task_count" -ne 30 ]; then' in leaf - # tau3's verifier/user simulator needs OpenAI even when the agent model is - # hosted by another provider, so missing credentials should fail preflight. - assert "contains(inputs.dataset, 'tau3')" in leaf + # tau3's verifier/judge is always an OpenAI model, so the leaf provides the + # OpenAI key unconditionally, and the preflight fails loudly if it is missing + # for a tau3 run whose agent model is hosted by another provider. + assert "OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}" in leaf assert '[[ "$HARBOR_DATASET" == *tau3* ]]' in leaf assert '[ "$model_provider" != "openai" ]' in leaf From 068c4080f69c9954b126d4cf5ba99c449968610f Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 11:55:54 -0400 Subject: [PATCH 37/48] fix(evals): enumerate tau3-subset from its committed task list, not the registry Full-profile enumerate sent the conversation category's synthetic dataset name "tau3-subset" to the harbor registry client, which rejects it (not an org/name package) and failed prep. Resolve synthetic datasets from their committed task list (deepagents_evals.tau3_subset.INCLUDE_TASKS, the same source _harbor_run.yml uses) instead of a registry lookup. Sharding stays compatible: the leaf skips its 30-count tripwire for caller-provided include_tasks. --- .github/scripts/enumerate_tasks.py | 29 ++++++++++++++++++++++++- .github/scripts/test_enumerate_tasks.py | 23 ++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/scripts/enumerate_tasks.py b/.github/scripts/enumerate_tasks.py index dffae2f0435..9e56d895f47 100644 --- a/.github/scripts/enumerate_tasks.py +++ b/.github/scripts/enumerate_tasks.py @@ -2,6 +2,8 @@ Reuses the exact task-name resolution the run step uses: - local (--path) datasets: subdir basenames with a task.toml (sorted, stable), + - synthetic datasets (e.g. "tau3-subset"): a committed task list, since the + name is not a registry package and would fail a registry lookup, - registry datasets: PackageDatasetClient manifest task_ids -> get_name(). Registry lookups need harbor installed and network; the local path is pure @@ -44,10 +46,35 @@ def registry_task_names(dataset_ref: str) -> list[str]: return names +def tau3_subset_task_names() -> list[str]: + # "tau3-subset" is a synthetic curated view, not a registry package, so it + # cannot be resolved via the registry client. Pull its committed 30-task + # list from the same module the harbor leaf uses (single source of truth). + from deepagents_evals.tau3_subset import INCLUDE_TASKS + + names = INCLUDE_TASKS.split() + if not names: + raise SystemExit( + "tau3-subset resolved to 0 tasks; " + "deepagents_evals.tau3_subset.INCLUDE_TASKS is empty." + ) + return names + + +# Synthetic datasets resolve to a committed task list instead of a registry +# lookup, because their names are not `org/name` registry packages. +SYNTHETIC_DATASETS = {"tau3-subset": tau3_subset_task_names} + + def main() -> int: dataset_path = os.environ.get("ENUM_DATASET_PATH", "").strip() dataset = os.environ.get("ENUM_DATASET", "").strip() - names = local_task_names(dataset_path) if dataset_path else registry_task_names(dataset) + if dataset_path: + names = local_task_names(dataset_path) + elif dataset in SYNTHETIC_DATASETS: + names = SYNTHETIC_DATASETS[dataset]() + else: + names = registry_task_names(dataset) out = os.environ.get("ENUM_OUTPUT") text = "\n".join(names) + "\n" if out: diff --git a/.github/scripts/test_enumerate_tasks.py b/.github/scripts/test_enumerate_tasks.py index 42459a2e6ee..0ebf6ae5a93 100644 --- a/.github/scripts/test_enumerate_tasks.py +++ b/.github/scripts/test_enumerate_tasks.py @@ -17,3 +17,26 @@ def test_local_task_names_empty_raises(tmp_path): import pytest with pytest.raises(SystemExit, match="No local Harbor tasks"): et.local_task_names(str(tmp_path)) + + +def test_tau3_subset_is_registered_synthetic(): + # "tau3-subset" is not an org/name registry package, so it must resolve via + # a synthetic resolver rather than the registry client. + assert "tau3-subset" in et.SYNTHETIC_DATASETS + + +def test_main_routes_synthetic_dataset_not_registry(tmp_path, monkeypatch): + import pytest + + out = tmp_path / "names.txt" + monkeypatch.setitem(et.SYNTHETIC_DATASETS, "tau3-subset", lambda: ["a", "b", "c"]) + monkeypatch.setenv("ENUM_DATASET", "tau3-subset") + monkeypatch.setenv("ENUM_OUTPUT", str(out)) + monkeypatch.delenv("ENUM_DATASET_PATH", raising=False) + monkeypatch.setattr( + et, + "registry_task_names", + lambda _ref: pytest.fail("registry must not be queried for a synthetic dataset"), + ) + assert et.main() == 0 + assert out.read_text().split() == ["a", "b", "c"] From 3b7bd6a970895705637ec10ef30fc228949d82ce Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 16:28:26 -0400 Subject: [PATCH 38/48] fix(evals): address open-swe review on flat-pool unified evals - unified_prep.py: total_job_guard counted the raw pre-pack task count, but build_flat_matrix packs each model to at most MAX_SHARDS (200) shards. A valid 2-model full run (e.g. 2x280 tasks -> 2x200=400 jobs, within budget) was rejected on a 2x280=560 miscount. Guard on the packed shard count. - _harbor_run.yml: the per-category aggregate legs all received the single global needs.harbor.result, so one failed shard marked every category's summary incomplete. On the flat multi-category path, rely on the per-category --expected-shards count and drop the global result; the single-dataset path (one category) still passes it. --- .github/scripts/test_unified_prep.py | 30 ++++++++++++++++++++++++++-- .github/scripts/unified_prep.py | 29 +++++++++++++++++---------- .github/workflows/_harbor_run.yml | 15 +++++++++++++- 3 files changed, 60 insertions(+), 14 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 978bc2238e1..1cbcd6a199c 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -125,13 +125,39 @@ def test_main_emits_expected_models_and_categories(tmp_path, monkeypatch): def test_total_job_guard_allows_within_budget(): - up.total_job_guard(n_models=2, est_tasks_per_model=142) # 284 <= 400, no raise + up.total_job_guard(n_models=2, shards_per_model=142) # 284 <= 400, no raise def test_total_job_guard_rejects_over_budget(): import pytest with pytest.raises(SystemExit, match=r"worker pool"): - up.total_job_guard(n_models=3, est_tasks_per_model=142) # 426 > 400 + up.total_job_guard(n_models=3, shards_per_model=142) # 426 > 400 + + +def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch): + # A full run whose raw task count exceeds MAX_SHARDS packs down to at most + # MAX_SHARDS jobs per model. The guard must count those packed shards, not + # the raw tasks: 2 models x 280 tasks -> 2 x 200 = 400 jobs (within the + # 400 budget). Guarding on the raw 2 x 280 = 560 would wrongly reject it. + import json as _j + + n_tasks = up.shard_matrix.MAX_SHARDS + 80 # 280, > MAX_SHARDS (200) + tasks_json = tmp_path / "tasks.json" + tasks_json.write_text( + _j.dumps({"autonomous": [f"harbor-index/t-{i}" for i in range(n_tasks)]}) + ) + monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus,openai:gpt") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") + monkeypatch.setenv("UNIFIED_PROFILE", "full") + monkeypatch.setenv("UNIFIED_TASKS_JSON", str(tasks_json)) + monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) + + assert up.main([]) == 0 # would SystemExit if the guard counted raw tasks + lines = dict(line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines()) + for model in ("anthropic:opus", "openai:gpt"): + entry = next(e for e in _j.loads(lines["eval_matrix"])["include"] if e["model"] == model) + n_entries = len(_j.loads(entry["flat_matrix"])["include"]) + assert n_entries <= up.shard_matrix.MAX_SHARDS def test_build_flat_matrix_one_entry_per_task_across_categories(): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 9b52ede9cfc..b299f5b3126 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -13,9 +13,9 @@ runners stay within MAX_RUNNERS. Both invariants hold by construction: per model: concurrency * max_parallel <= MAX_TASKS_PER_MODEL (40) global: model_parallel * max_parallel <= MAX_RUNNERS (80) -`total_job_guard` separately caps the total job count (n_models * est_tasks) -against a fixed budget so an oversized selection fails fast instead of -launching a firehose. +`total_job_guard` separately caps the total job count (n_models * shards +per model, post-pack) against a fixed budget so an oversized selection fails +fast instead of launching a firehose. """ from __future__ import annotations @@ -90,19 +90,20 @@ TOTAL_JOB_BUDGET = 400 -def total_job_guard(n_models: int, est_tasks_per_model: int) -> None: +def total_job_guard(n_models: int, shards_per_model: int) -> None: """Fail when the flat matrix would generate too many total jobs. - At 1-task/shard the run generates n_models * est_tasks jobs. GitHub-hosted - Actions become unreliable well before that count needs to be large, so cap - it and point at the worker-pool escalation instead of silently launching a - firehose. + Each model emits `shards_per_model` shard jobs (already packed to at most + `shard_matrix.MAX_SHARDS`), so the run launches n_models * shards_per_model + jobs. GitHub-hosted Actions become unreliable well before that count needs + to be large, so cap it and point at the worker-pool escalation instead of + silently launching a firehose. """ - total = n_models * est_tasks_per_model + total = n_models * shards_per_model if total > TOTAL_JOB_BUDGET: raise SystemExit( f"Flat matrix would generate ~{total} jobs " - f"({n_models} models x ~{est_tasks_per_model} tasks), over " + f"({n_models} models x ~{shards_per_model} shards), over " f"TOTAL_JOB_BUDGET={TOTAL_JOB_BUDGET}. Reduce the model set or task " "count, or move to a worker pool orchestrator (see the flat-pool spec)." ) @@ -316,7 +317,13 @@ def main(argv: list[str] | None = None) -> int: n_models = len(model_specs) est_tasks = max(sum(len(tasks_by_cat.get(c, [])) for c in categories), 1) - total_job_guard(n_models, est_tasks) + # Jobs launched per model = flat-matrix entries, which build_flat_matrix + # packs down to at most shard_matrix.MAX_SHARDS -- not the raw task count. + # Guard on the packed count so a valid multi-model full run is not rejected + # on a miscount: e.g. 2 models x 280 tasks packs to 2 x 200 = 400 jobs + # (within budget), while the raw 2 x 280 = 560 would trip the guard. + packed_per_model = min(est_tasks, shard_matrix.MAX_SHARDS) + total_job_guard(n_models, packed_per_model) # n_shards for the pool = number of single-task shards (pre-pack); derive pool. n_shards = est_tasks diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index f76dce9c319..db4058939a5 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -1006,6 +1006,7 @@ jobs: MODEL: ${{ inputs.model }} CATEGORY: ${{ matrix.category }} EXPECTED_SHARDS: ${{ matrix.expected_shards }} + FLAT_MATRIX: ${{ inputs.flat_matrix }} run: | if ! [[ "$ROLLOUTS" =~ ^[1-9][0-9]*$ ]]; then echo "::error::Invalid rollouts_per_task: $ROLLOUTS" @@ -1015,6 +1016,18 @@ jobs: if [ -n "$EXPECTED_SHARDS" ]; then expected_shards_args=(--expected-shards "$EXPECTED_SHARDS") fi + # needs.harbor.result is the single result of the whole harbor matrix. + # On a flat multi-category run that matrix spans every category, so one + # failed shard would mark *every* category's summary incomplete. There + # the per-category --expected-shards count is the category-local + # completeness authority (a category whose shards all uploaded is + # complete regardless of a sibling category's failure), so the global + # result is not passed. The single-dataset path (one category leg) + # keeps it: that result maps to its lone category. + harbor_result_args=() + if [ -z "$FLAT_MATRIX" ]; then + harbor_result_args=(--harbor-result "$HARBOR_RESULT") + fi # --model/--category are recorded authoritatively in summary.json # (model is otherwise null when every trial errored). python3 .github/scripts/aggregate_shards.py _shards \ @@ -1023,7 +1036,7 @@ jobs: --dataset "$DATASET" \ --model "$MODEL" \ --category "$CATEGORY" \ - --harbor-result "$HARBOR_RESULT" \ + "${harbor_result_args[@]}" \ --out-dir _shards - name: "📤 Upload combined results" From bcda26ea20077fb33979daf9030980d2c0aeabb0 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 16:40:03 -0400 Subject: [PATCH 39/48] fix(evals): guard on exact packed shard count, not a loose bound The prior fix bounded jobs/model by min(est_tasks, MAX_SHARDS), but build_flat_matrix's ceil-division packing usually emits fewer entries than MAX_SHARDS (e.g. 120+120+40 tasks -> 140, not 200). The loose bound still wrongly rejected valid runs (3 models x 260 tasks packs to 3x130=390 <= 400, yet 3x200=600 tripped the guard). Measure the real per-model entry count via build_flat_matrix (model-independent) and guard on that. Regression test pins the discriminating 3-model case. --- .github/scripts/test_unified_prep.py | 29 +++++++++++++++++----------- .github/scripts/unified_prep.py | 18 +++++++++++------ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 1cbcd6a199c..542eda9f265 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -135,29 +135,36 @@ def test_total_job_guard_rejects_over_budget(): def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch): - # A full run whose raw task count exceeds MAX_SHARDS packs down to at most - # MAX_SHARDS jobs per model. The guard must count those packed shards, not - # the raw tasks: 2 models x 280 tasks -> 2 x 200 = 400 jobs (within the - # 400 budget). Guarding on the raw 2 x 280 = 560 would wrongly reject it. + # The guard must count the packed flat-matrix entries, not the raw task + # count. 260 tasks pack (via ceil division) to 130 shards/model, so 3 models + # emit 3 x 130 = 390 jobs, within the 400 budget. Guarding on the raw count + # (3 x 260 = 780) -- or on the loose min(tasks, MAX_SHARDS)=200 bound + # (3 x 200 = 600) -- would wrongly reject this valid run. import json as _j - n_tasks = up.shard_matrix.MAX_SHARDS + 80 # 280, > MAX_SHARDS (200) + n_tasks = 260 + packed = len( + up.build_flat_matrix("x:y", ["autonomous"], {"autonomous": ["t"] * n_tasks}) + ) + assert packed == 130 # pins the packing so the budget arithmetic below is real + assert 3 * packed <= up.TOTAL_JOB_BUDGET < 3 * min(n_tasks, up.shard_matrix.MAX_SHARDS) + tasks_json = tmp_path / "tasks.json" tasks_json.write_text( _j.dumps({"autonomous": [f"harbor-index/t-{i}" for i in range(n_tasks)]}) ) - monkeypatch.setenv("UNIFIED_MODELS", "anthropic:opus,openai:gpt") + monkeypatch.setenv("UNIFIED_MODELS", "anthropic:a,anthropic:b,anthropic:c") monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") monkeypatch.setenv("UNIFIED_PROFILE", "full") monkeypatch.setenv("UNIFIED_TASKS_JSON", str(tasks_json)) monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) - assert up.main([]) == 0 # would SystemExit if the guard counted raw tasks + assert up.main([]) == 0 # SystemExit if the guard over-counts (raw or loose bound) lines = dict(line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines()) - for model in ("anthropic:opus", "openai:gpt"): - entry = next(e for e in _j.loads(lines["eval_matrix"])["include"] if e["model"] == model) - n_entries = len(_j.loads(entry["flat_matrix"])["include"]) - assert n_entries <= up.shard_matrix.MAX_SHARDS + entries = _j.loads(lines["eval_matrix"])["include"] + assert len(entries) == 3 + for entry in entries: + assert len(_j.loads(entry["flat_matrix"])["include"]) == packed def test_build_flat_matrix_one_entry_per_task_across_categories(): diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index b299f5b3126..417be90d185 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -317,12 +317,18 @@ def main(argv: list[str] | None = None) -> int: n_models = len(model_specs) est_tasks = max(sum(len(tasks_by_cat.get(c, [])) for c in categories), 1) - # Jobs launched per model = flat-matrix entries, which build_flat_matrix - # packs down to at most shard_matrix.MAX_SHARDS -- not the raw task count. - # Guard on the packed count so a valid multi-model full run is not rejected - # on a miscount: e.g. 2 models x 280 tasks packs to 2 x 200 = 400 jobs - # (within budget), while the raw 2 x 280 = 560 would trip the guard. - packed_per_model = min(est_tasks, shard_matrix.MAX_SHARDS) + # Jobs launched per model = the packed flat-matrix entry count, not the raw + # task count: build_flat_matrix groups tasks into at most MAX_SHARDS shards, + # and ceil-division packing usually yields fewer (e.g. 120+120+40 tasks pack + # to 140 entries, not 200). The count is model-independent, so measure it + # once on the first model and guard on the real emitted job total. Guarding + # on the raw task count would reject valid multi-model full runs whose packed + # total is within budget (e.g. 3 models x 260 tasks -> 3 x 130 = 390 <= 400). + packed_per_model = ( + len(build_flat_matrix(model_specs[0], categories, tasks_by_cat, code_impl)) + if model_specs + else 0 + ) total_job_guard(n_models, packed_per_model) # n_shards for the pool = number of single-task shards (pre-pack); derive pool. From 68fe22bd96aee033c3349ac5218212264ac72e70 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 16:54:09 -0400 Subject: [PATCH 40/48] fix(evals): score errored trials as failures, don't void the scorecard A trial that ran but produced no usable verifier reward (timeout, OOM, exception) is already scored 0 by build_summary; it must not also flag the run incomplete. In the flat pool needs.harbor.result spans every category, so one errored autonomous shard was flagging fully-complete conversation/context as incomplete, and the combiner then voided the entire cross-model scorecard. aggregate_shards.py: incomplete now reflects only genuine coverage/integrity gaps (shard shortfall vs expected_shards, unreadable/non-numeric results); harbor_result and off-K rollout counts are recorded as diagnostics, not incompleteness. aggregate_unified.py: emit a warning and still write the scorecard instead of exiting 1 when every model is incomplete. --- .github/scripts/aggregate_shards.py | 66 ++++++++++++----------- .github/scripts/aggregate_unified.py | 9 ++-- .github/scripts/test_aggregate_shards.py | 31 +++++++---- .github/scripts/test_aggregate_unified.py | 28 ++++++---- 4 files changed, 80 insertions(+), 54 deletions(-) diff --git a/.github/scripts/aggregate_shards.py b/.github/scripts/aggregate_shards.py index aa136e44292..82978453249 100644 --- a/.github/scripts/aggregate_shards.py +++ b/.github/scripts/aggregate_shards.py @@ -10,18 +10,23 @@ push a task above 1) over the EXPECTED trial count (tasks * rollouts), so missing rollouts of a present task count as failures. -The summary is flagged ``incomplete`` when a full run cannot be vouched for: -the matrix job did not fully succeed (``--harbor-result`` != "success"); a -present task ran a number of trials other than K (missing OR duplicated -rollouts); a ``result.json`` could not be read; a reward was present but -non-numeric; or (when ``--expected-shards`` is given) fewer shards completed than -expected. Legitimately-empty shards upload ``empty-shard-*`` markers and count as -completed rather than missing. +The summary is flagged ``incomplete`` only when data is genuinely missing or +untrustworthy: fewer shards completed than expected (when ``--expected-shards`` +is given); a ``result.json`` could not be read; or a reward was present but +non-numeric. A trial that RAN but produced no usable verifier reward (a timeout, +OOM, or exception) is a scored failure, not missing data -- it is counted as a +non-pass and does NOT, by itself, flag the run incomplete. ``--harbor-result`` +reflects the whole harbor matrix (every category in the flat pool), so one +errored shard would otherwise void unrelated, fully-complete categories; it and +off-K per-task rollout counts are recorded for diagnostics but no longer mark a +run incomplete. Legitimately-empty shards upload ``empty-shard-*`` markers and +count as completed rather than missing. A trial is a pass when its verifier reward is >= PASS_THRESHOLD. ``errored`` is an independent diagnostic tally: a Harbor result that records ``exception_info`` and a verifier-passing reward counts as both passed and errored. Missing or -non-numeric verifier rewards are not passes and are counted as errored. +non-numeric verifier rewards are not passes and are counted as errored (and +scored as failures). Aggregation is single-model on purpose: a run is one model's evaluation of one dataset (a "category" in the wider harness). If results from more than one model @@ -373,26 +378,22 @@ def write_outputs(summary: dict, per_task: list[dict], out_dir: Path) -> None: def _incomplete_reason( *, - shard_failure: bool, shard_shortfall: bool, - count_mismatch: bool, skipped_files: int, malformed_rewards: int, - totals: dict[str, int], shards_found: int, expected_shards: int | None, ) -> str: - """Human-readable summary of why a run was flagged incomplete (for the annotation).""" + """Human-readable summary of why a run was flagged incomplete (for the annotation). + + Only genuine missing/corrupt-data signals flag incomplete: a shard shortfall + (fewer shards than expected), unreadable result files, or non-numeric rewards. + A shard job reporting failure or off-K rollout counts is diagnostic only (see + module docstring) and is reported separately, not here. + """ reasons = [] - if shard_failure: - reasons.append("a shard job did not succeed") if shard_shortfall: reasons.append(f"only {shards_found}/{expected_shards} shards reported") - if count_mismatch: - reasons.append( - "per-task rollout counts differ from K " - f"(trials {totals['trials']}/{totals['expected_trials']})" - ) if skipped_files: reasons.append(f"{skipped_files} unreadable result file(s)") if malformed_rewards: @@ -471,7 +472,7 @@ def main(argv: list[str] | None = None) -> int: data_loss = agg.skipped_files > 0 or agg.malformed_rewards > 0 if not agg.by_task: - incomplete = shard_failure or shard_shortfall or data_loss + incomplete = shard_shortfall or data_loss summary = make_summary( dataset=args.dataset, model=args.model, @@ -499,12 +500,9 @@ def main(argv: list[str] | None = None) -> int: emit_annotation( "::warning::No trial results found for a run expected to produce them (" + _incomplete_reason( - shard_failure=shard_failure, shard_shortfall=shard_shortfall, - count_mismatch=False, skipped_files=agg.skipped_files, malformed_rewards=agg.malformed_rewards, - totals=summary["totals"], shards_found=shards_found, expected_shards=args.expected_shards, ) @@ -521,13 +519,16 @@ def main(argv: list[str] | None = None) -> int: ) parts = build_summary(agg.by_task, args.rollouts) - # Incomplete if a shard job failed, a shard is missing, a present task ran a - # number of trials other than K (missing OR duplicated rollouts), or a result - # was unreadable / had a non-numeric reward. + # Incomplete only when coverage is genuinely missing (fewer shards than + # expected) or a result was unreadable / had a non-numeric reward. A shard + # job reporting failure -- harbor_result spans every category in the flat + # pool, so one errored shard would otherwise void unrelated categories -- and + # off-K per-task rollout counts are diagnostics only: errored and missing + # trials are already scored as failures by build_summary. count_mismatch = any( stats["trials"] != args.rollouts for stats in agg.by_task.values() ) - incomplete = shard_failure or shard_shortfall or data_loss or count_mismatch + incomplete = shard_shortfall or data_loss summary = make_summary( dataset=args.dataset, model=args.model or (next(iter(agg.models)) if agg.models else None), @@ -546,17 +547,22 @@ def main(argv: list[str] | None = None) -> int: emit_annotation( "::warning::Aggregated an incomplete run (" + _incomplete_reason( - shard_failure=shard_failure, shard_shortfall=shard_shortfall, - count_mismatch=count_mismatch, skipped_files=agg.skipped_files, malformed_rewards=agg.malformed_rewards, - totals=parts.totals, shards_found=shards_found, expected_shards=args.expected_shards, ) + "); missing rollouts counted as failures." ) + elif shard_failure or count_mismatch: + # Coverage is complete for this category; note the diagnostic without + # voiding the run (errored/missing trials are scored as failures). + emit_annotation( + "::warning::A shard job reported failure or off-K rollout counts, but " + "this category's coverage is complete; errored/missing trials are " + "scored as failures rather than marked incomplete." + ) write_outputs(summary, parts.per_task, out_dir) return 0 diff --git a/.github/scripts/aggregate_unified.py b/.github/scripts/aggregate_unified.py index c3325ba2dfa..25a0452664f 100644 --- a/.github/scripts/aggregate_unified.py +++ b/.github/scripts/aggregate_unified.py @@ -373,15 +373,18 @@ def main(argv: list[str] | None = None) -> int: write_outputs( combined, args.rollouts, out_dir, os.environ.get("GITHUB_STEP_SUMMARY") ) + # Incompleteness is surfaced per model in write_outputs (a ::warning:: plus the + # ⚠️ markers in the table) and never fails the job: a partial scorecard the + # reader can inspect beats a voided run with no output. A single errored shard + # no longer nukes the whole cross-model comparison. models = combined["models"] if expected_models and all( models[model]["incomplete"] for model in expected_models ): print( - "::error::Every expected model is incomplete; " - "no complete unified result is available." + "::warning::All expected models were flagged incomplete; the scorecard " + "below is ranked on partial data — inspect the per-model notes above." ) - return 1 return 0 diff --git a/.github/scripts/test_aggregate_shards.py b/.github/scripts/test_aggregate_shards.py index 6d1c8d7e990..a20739dd395 100644 --- a/.github/scripts/test_aggregate_shards.py +++ b/.github/scripts/test_aggregate_shards.py @@ -149,11 +149,16 @@ def test_missing_rollouts_count_as_failures(tmp_path: Path): assert abs(summary["avg@3"] - 1 / 3) < 1e-6 assert summary["totals"]["trials"] == 1 assert summary["totals"]["expected_trials"] == 3 - assert summary["incomplete"] is True # 1 trial < 3 expected + # A missing rollout is scored as a failure (avg@3 = 1/3 above), not flagged + # incomplete: the trial's absence is already reflected in the score. + assert summary["incomplete"] is False -def test_shard_failure_flags_incomplete(tmp_path: Path): - # A complete task, but the matrix job did not fully succeed (a shard failed). +def test_shard_failure_does_not_flag_incomplete(tmp_path: Path): + # The matrix job did not fully succeed, but this category's coverage is + # complete. harbor_result spans every category in the flat pool, so an errored + # shard elsewhere must NOT void a category whose data is all present; the + # result is still recorded for diagnostics. _write_trial(tmp_path / "a__0", "taskA", reward=1.0) _write_trial(tmp_path / "a__1", "taskA", reward=1.0) out = tmp_path / "out" @@ -171,7 +176,7 @@ def test_shard_failure_flags_incomplete(tmp_path: Path): assert rc == 0 summary = json.loads((out / "summary.json").read_text()) assert summary["harbor_result"] == "failure" - assert summary["incomplete"] is True + assert summary["incomplete"] is False def test_filtered_run_with_success_is_not_incomplete(tmp_path: Path): @@ -305,9 +310,10 @@ def test_rollouts_below_one_is_rejected(tmp_path: Path): raise AssertionError("expected SystemExit for --rollouts 0") -def test_duplicate_rollouts_flag_incomplete(tmp_path: Path): - # A task with MORE than K trials (e.g. a double-download) must not silently - # inflate avg@K past 1.0 without flagging the run. +def test_duplicate_rollouts_are_capped_not_incomplete(tmp_path: Path): + # A task with MORE than K trials (e.g. a double-download) must not inflate + # avg@K past 1.0. Capping is the guarantee; an off-K rollout count is a + # diagnostic, not a reason to void the run. _write_trial(tmp_path / "a__0", "taskA", reward=1.0) _write_trial(tmp_path / "a__1", "taskA", reward=1.0) out = tmp_path / "out" @@ -316,8 +322,8 @@ def test_duplicate_rollouts_flag_incomplete(tmp_path: Path): assert summary["totals"]["trials"] == 2 assert summary["totals"]["expected_trials"] == 1 assert summary["totals"]["passed"] == 2 - assert summary["avg@1"] == 1.0 - assert summary["incomplete"] is True # trials != expected + assert summary["avg@1"] == 1.0 # capped, not 2.0 + assert summary["incomplete"] is False def test_duplicate_rollout_summary_is_accepted_by_unified_aggregator( @@ -345,7 +351,7 @@ def test_duplicate_rollout_summary_is_accepted_by_unified_aggregator( assert leaf["model"] == "m1" assert leaf["category"] == "context" assert leaf["avg_at_k"] == 1.0 - assert leaf["incomplete"] is True + assert leaf["incomplete"] is False def test_per_task_rollout_mismatches_do_not_cancel(tmp_path: Path): @@ -360,8 +366,11 @@ def test_per_task_rollout_mismatches_do_not_cancel(tmp_path: Path): assert summary["totals"]["trials"] == 4 assert summary["totals"]["expected_trials"] == 4 assert summary["totals"]["passed"] == 4 + # taskA's 3rd pass is capped and taskB's missing rollout counts as a failure, + # so per-task mismatches do not cancel in the score (avg@2 = 3/4, not 1.0). + # The mismatch itself is diagnostic, not a reason to flag incomplete. assert summary["avg@2"] == 0.75 - assert summary["incomplete"] is True + assert summary["incomplete"] is False def test_expected_shards_shortfall_flags_incomplete(tmp_path: Path): diff --git a/.github/scripts/test_aggregate_unified.py b/.github/scripts/test_aggregate_unified.py index b0c1c786503..07f341dcb79 100644 --- a/.github/scripts/test_aggregate_unified.py +++ b/.github/scripts/test_aggregate_unified.py @@ -492,26 +492,30 @@ def test_main_rejects_nonpositive_rollouts( assert "--rollouts must be >= 1" in capsys.readouterr().err -def test_main_fails_only_when_every_expected_model_is_incomplete( +def test_main_warns_but_succeeds_when_every_expected_model_is_incomplete( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], ) -> None: + # An incomplete run must still produce a usable scorecard (exit 0) rather than + # voiding everything; the incompleteness is surfaced as a warning. monkeypatch.setenv("EXPECTED_MODELS", '["m"]') monkeypatch.setenv("EXPECTED_CATEGORIES", '["context"]') out = tmp_path / "combined" rc = au.main([str(tmp_path), "--rollouts", "3", "--out-dir", str(out)]) - assert rc == 1 + assert rc == 0 assert (out / "unified_summary.json").exists() - assert "::error::Every expected model is incomplete" in capsys.readouterr().out + assert "::warning::All expected models were flagged incomplete" in ( + capsys.readouterr().out + ) _leaf_dir(tmp_path, "m", "context") assert au.main([str(tmp_path), "--rollouts", "3", "--out-dir", str(out)]) == 0 -def test_main_fails_when_required_leaf_has_no_tasks( +def test_main_warns_when_required_leaf_has_no_tasks( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], @@ -533,13 +537,15 @@ def test_main_fails_when_required_leaf_has_no_tasks( combined = json.loads((out / "unified_summary.json").read_text()) model = combined["models"]["m"] - assert rc == 1 + assert rc == 0 assert model["categories"]["context"]["incomplete"] is True assert model["incomplete"] is True - assert "::error::Every expected model is incomplete" in capsys.readouterr().out + assert "::warning::All expected models were flagged incomplete" in ( + capsys.readouterr().out + ) -def test_main_ignores_unexpected_complete_model_for_expected_grid_failure( +def test_main_ignores_unexpected_complete_model_for_expected_grid( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], @@ -551,8 +557,10 @@ def test_main_ignores_unexpected_complete_model_for_expected_grid_failure( rc = au.main([str(tmp_path), "--rollouts", "3", "--out-dir", str(out)]) - assert rc == 1 - assert "::error::Every expected model is incomplete" in capsys.readouterr().out + assert rc == 0 + assert "::warning::All expected models were flagged incomplete" in ( + capsys.readouterr().out + ) def test_main_does_not_apply_expected_grid_failure_without_expected_models( @@ -588,7 +596,7 @@ def test_main_warns_and_skips_leaf_with_mismatched_rollouts( output = capsys.readouterr().out combined = json.loads((out / "unified_summary.json").read_text()) - assert rc == 1 + assert rc == 0 assert "rollouts_per_task is 2; expected 3" in output assert combined["models"]["m"]["missing_categories"] == ["context"] From 8ff9664b0a534e7d8cbef9f34c8b2e648726ef65 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 16:57:02 -0400 Subject: [PATCH 41/48] docs(evals): add gpt-5.6-terra full scorecard Full-profile results (run 29430259116), re-aggregated from the run's existing artifacts after the incomplete-flag fix; autonomous's 14 errored trials count as failures and one shard was recovered from the retry attempt. No tasks re-run. --- libs/evals/UNIFIED_SCORECARD.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libs/evals/UNIFIED_SCORECARD.md b/libs/evals/UNIFIED_SCORECARD.md index aa269f599af..7009336d04e 100644 --- a/libs/evals/UNIFIED_SCORECARD.md +++ b/libs/evals/UNIFIED_SCORECARD.md @@ -2,6 +2,22 @@ GH aggregate pass@k / avg@k from `.github/workflows/unified_evals.yml`. pass@k = fraction of tasks solved in ≥1 of k rollouts; avg@k = mean reward across rollouts; rewards are binary (0/1). +## openai:gpt-5.6-terra + +### Full (default) + +| Category | pass@k | avg@k | tasks | +| --- | --- | --- | --- | +| autonomous (harbor-index) | 0.268 | 0.183 | 82 | +| conversation (tau3-subset) | 0.467 | 0.389 | 30 | +| context (context-retrieval) | 0.667 | 0.567 | 30 | +| **macro** | **0.467** | **0.379** | | +| **micro** | **0.394** | **0.308** | | + +Run [29430259116](https://github.com/langchain-ai/deepagents/actions/runs/29430259116) · 2026-07-15 · `agent_impl=bare` · `profile=full` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` + +autonomous includes 14 of 246 trials that errored (agent/verifier timeouts and one OOM) and are scored as failures. Aggregated from the run's artifacts (one shard recovered from the retry attempt); no tasks were re-run. + ## openai:gpt-5.6-luna ### Full (default) From 5ac11edc8c510ef2c569f2033dab0c08c90813d2 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Wed, 15 Jul 2026 17:06:44 -0400 Subject: [PATCH 42/48] revert(evals): keep shard_failure in aggregate_shards incomplete gate Open SWE review flagged that dropping shard_failure lets a partial shard (some tasks absent) publish as complete. Verified: the flat-pool void-everything bug is already fixed at the workflow layer -- _harbor_run.yml skips --harbor-result on the flat path (`if [ -z "$FLAT_MATRIX" ]`), since that result spans every category. So dropping shard_failure was unnecessary for the flat path and harmful to the single-dataset (harbor.yml) path, where harbor_result maps to the lone category and is a valid completeness signal. Revert aggregate_shards.py + its tests to the original semantics; keep only the aggregate_unified.py change so a genuinely-incomplete model still yields a scorecard (with warnings) instead of failing the combine job. --- .github/scripts/aggregate_shards.py | 66 +++++++++++------------- .github/scripts/test_aggregate_shards.py | 31 ++++------- 2 files changed, 41 insertions(+), 56 deletions(-) diff --git a/.github/scripts/aggregate_shards.py b/.github/scripts/aggregate_shards.py index 82978453249..aa136e44292 100644 --- a/.github/scripts/aggregate_shards.py +++ b/.github/scripts/aggregate_shards.py @@ -10,23 +10,18 @@ push a task above 1) over the EXPECTED trial count (tasks * rollouts), so missing rollouts of a present task count as failures. -The summary is flagged ``incomplete`` only when data is genuinely missing or -untrustworthy: fewer shards completed than expected (when ``--expected-shards`` -is given); a ``result.json`` could not be read; or a reward was present but -non-numeric. A trial that RAN but produced no usable verifier reward (a timeout, -OOM, or exception) is a scored failure, not missing data -- it is counted as a -non-pass and does NOT, by itself, flag the run incomplete. ``--harbor-result`` -reflects the whole harbor matrix (every category in the flat pool), so one -errored shard would otherwise void unrelated, fully-complete categories; it and -off-K per-task rollout counts are recorded for diagnostics but no longer mark a -run incomplete. Legitimately-empty shards upload ``empty-shard-*`` markers and -count as completed rather than missing. +The summary is flagged ``incomplete`` when a full run cannot be vouched for: +the matrix job did not fully succeed (``--harbor-result`` != "success"); a +present task ran a number of trials other than K (missing OR duplicated +rollouts); a ``result.json`` could not be read; a reward was present but +non-numeric; or (when ``--expected-shards`` is given) fewer shards completed than +expected. Legitimately-empty shards upload ``empty-shard-*`` markers and count as +completed rather than missing. A trial is a pass when its verifier reward is >= PASS_THRESHOLD. ``errored`` is an independent diagnostic tally: a Harbor result that records ``exception_info`` and a verifier-passing reward counts as both passed and errored. Missing or -non-numeric verifier rewards are not passes and are counted as errored (and -scored as failures). +non-numeric verifier rewards are not passes and are counted as errored. Aggregation is single-model on purpose: a run is one model's evaluation of one dataset (a "category" in the wider harness). If results from more than one model @@ -378,22 +373,26 @@ def write_outputs(summary: dict, per_task: list[dict], out_dir: Path) -> None: def _incomplete_reason( *, + shard_failure: bool, shard_shortfall: bool, + count_mismatch: bool, skipped_files: int, malformed_rewards: int, + totals: dict[str, int], shards_found: int, expected_shards: int | None, ) -> str: - """Human-readable summary of why a run was flagged incomplete (for the annotation). - - Only genuine missing/corrupt-data signals flag incomplete: a shard shortfall - (fewer shards than expected), unreadable result files, or non-numeric rewards. - A shard job reporting failure or off-K rollout counts is diagnostic only (see - module docstring) and is reported separately, not here. - """ + """Human-readable summary of why a run was flagged incomplete (for the annotation).""" reasons = [] + if shard_failure: + reasons.append("a shard job did not succeed") if shard_shortfall: reasons.append(f"only {shards_found}/{expected_shards} shards reported") + if count_mismatch: + reasons.append( + "per-task rollout counts differ from K " + f"(trials {totals['trials']}/{totals['expected_trials']})" + ) if skipped_files: reasons.append(f"{skipped_files} unreadable result file(s)") if malformed_rewards: @@ -472,7 +471,7 @@ def main(argv: list[str] | None = None) -> int: data_loss = agg.skipped_files > 0 or agg.malformed_rewards > 0 if not agg.by_task: - incomplete = shard_shortfall or data_loss + incomplete = shard_failure or shard_shortfall or data_loss summary = make_summary( dataset=args.dataset, model=args.model, @@ -500,9 +499,12 @@ def main(argv: list[str] | None = None) -> int: emit_annotation( "::warning::No trial results found for a run expected to produce them (" + _incomplete_reason( + shard_failure=shard_failure, shard_shortfall=shard_shortfall, + count_mismatch=False, skipped_files=agg.skipped_files, malformed_rewards=agg.malformed_rewards, + totals=summary["totals"], shards_found=shards_found, expected_shards=args.expected_shards, ) @@ -519,16 +521,13 @@ def main(argv: list[str] | None = None) -> int: ) parts = build_summary(agg.by_task, args.rollouts) - # Incomplete only when coverage is genuinely missing (fewer shards than - # expected) or a result was unreadable / had a non-numeric reward. A shard - # job reporting failure -- harbor_result spans every category in the flat - # pool, so one errored shard would otherwise void unrelated categories -- and - # off-K per-task rollout counts are diagnostics only: errored and missing - # trials are already scored as failures by build_summary. + # Incomplete if a shard job failed, a shard is missing, a present task ran a + # number of trials other than K (missing OR duplicated rollouts), or a result + # was unreadable / had a non-numeric reward. count_mismatch = any( stats["trials"] != args.rollouts for stats in agg.by_task.values() ) - incomplete = shard_shortfall or data_loss + incomplete = shard_failure or shard_shortfall or data_loss or count_mismatch summary = make_summary( dataset=args.dataset, model=args.model or (next(iter(agg.models)) if agg.models else None), @@ -547,22 +546,17 @@ def main(argv: list[str] | None = None) -> int: emit_annotation( "::warning::Aggregated an incomplete run (" + _incomplete_reason( + shard_failure=shard_failure, shard_shortfall=shard_shortfall, + count_mismatch=count_mismatch, skipped_files=agg.skipped_files, malformed_rewards=agg.malformed_rewards, + totals=parts.totals, shards_found=shards_found, expected_shards=args.expected_shards, ) + "); missing rollouts counted as failures." ) - elif shard_failure or count_mismatch: - # Coverage is complete for this category; note the diagnostic without - # voiding the run (errored/missing trials are scored as failures). - emit_annotation( - "::warning::A shard job reported failure or off-K rollout counts, but " - "this category's coverage is complete; errored/missing trials are " - "scored as failures rather than marked incomplete." - ) write_outputs(summary, parts.per_task, out_dir) return 0 diff --git a/.github/scripts/test_aggregate_shards.py b/.github/scripts/test_aggregate_shards.py index a20739dd395..6d1c8d7e990 100644 --- a/.github/scripts/test_aggregate_shards.py +++ b/.github/scripts/test_aggregate_shards.py @@ -149,16 +149,11 @@ def test_missing_rollouts_count_as_failures(tmp_path: Path): assert abs(summary["avg@3"] - 1 / 3) < 1e-6 assert summary["totals"]["trials"] == 1 assert summary["totals"]["expected_trials"] == 3 - # A missing rollout is scored as a failure (avg@3 = 1/3 above), not flagged - # incomplete: the trial's absence is already reflected in the score. - assert summary["incomplete"] is False + assert summary["incomplete"] is True # 1 trial < 3 expected -def test_shard_failure_does_not_flag_incomplete(tmp_path: Path): - # The matrix job did not fully succeed, but this category's coverage is - # complete. harbor_result spans every category in the flat pool, so an errored - # shard elsewhere must NOT void a category whose data is all present; the - # result is still recorded for diagnostics. +def test_shard_failure_flags_incomplete(tmp_path: Path): + # A complete task, but the matrix job did not fully succeed (a shard failed). _write_trial(tmp_path / "a__0", "taskA", reward=1.0) _write_trial(tmp_path / "a__1", "taskA", reward=1.0) out = tmp_path / "out" @@ -176,7 +171,7 @@ def test_shard_failure_does_not_flag_incomplete(tmp_path: Path): assert rc == 0 summary = json.loads((out / "summary.json").read_text()) assert summary["harbor_result"] == "failure" - assert summary["incomplete"] is False + assert summary["incomplete"] is True def test_filtered_run_with_success_is_not_incomplete(tmp_path: Path): @@ -310,10 +305,9 @@ def test_rollouts_below_one_is_rejected(tmp_path: Path): raise AssertionError("expected SystemExit for --rollouts 0") -def test_duplicate_rollouts_are_capped_not_incomplete(tmp_path: Path): - # A task with MORE than K trials (e.g. a double-download) must not inflate - # avg@K past 1.0. Capping is the guarantee; an off-K rollout count is a - # diagnostic, not a reason to void the run. +def test_duplicate_rollouts_flag_incomplete(tmp_path: Path): + # A task with MORE than K trials (e.g. a double-download) must not silently + # inflate avg@K past 1.0 without flagging the run. _write_trial(tmp_path / "a__0", "taskA", reward=1.0) _write_trial(tmp_path / "a__1", "taskA", reward=1.0) out = tmp_path / "out" @@ -322,8 +316,8 @@ def test_duplicate_rollouts_are_capped_not_incomplete(tmp_path: Path): assert summary["totals"]["trials"] == 2 assert summary["totals"]["expected_trials"] == 1 assert summary["totals"]["passed"] == 2 - assert summary["avg@1"] == 1.0 # capped, not 2.0 - assert summary["incomplete"] is False + assert summary["avg@1"] == 1.0 + assert summary["incomplete"] is True # trials != expected def test_duplicate_rollout_summary_is_accepted_by_unified_aggregator( @@ -351,7 +345,7 @@ def test_duplicate_rollout_summary_is_accepted_by_unified_aggregator( assert leaf["model"] == "m1" assert leaf["category"] == "context" assert leaf["avg_at_k"] == 1.0 - assert leaf["incomplete"] is False + assert leaf["incomplete"] is True def test_per_task_rollout_mismatches_do_not_cancel(tmp_path: Path): @@ -366,11 +360,8 @@ def test_per_task_rollout_mismatches_do_not_cancel(tmp_path: Path): assert summary["totals"]["trials"] == 4 assert summary["totals"]["expected_trials"] == 4 assert summary["totals"]["passed"] == 4 - # taskA's 3rd pass is capped and taskB's missing rollout counts as a failure, - # so per-task mismatches do not cancel in the score (avg@2 = 3/4, not 1.0). - # The mismatch itself is diagnostic, not a reason to flag incomplete. assert summary["avg@2"] == 0.75 - assert summary["incomplete"] is False + assert summary["incomplete"] is True def test_expected_shards_shortfall_flags_incomplete(tmp_path: Path): From 39aad658c3b26f58b196682f004985cadeb2b96c Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Thu, 16 Jul 2026 10:40:06 -0400 Subject: [PATCH 43/48] docs(evals): add gpt-5.6-terra lite scorecard + wall times Lite full-profile subset (run 29451389710): macro pass@3 0.440 / avg@3 0.269. Add approximate first-attempt wall time to both terra entries (full ~4h, lite ~1h). --- libs/evals/UNIFIED_SCORECARD.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libs/evals/UNIFIED_SCORECARD.md b/libs/evals/UNIFIED_SCORECARD.md index 7009336d04e..3721d01ba80 100644 --- a/libs/evals/UNIFIED_SCORECARD.md +++ b/libs/evals/UNIFIED_SCORECARD.md @@ -14,10 +14,24 @@ GH aggregate pass@k / avg@k from `.github/workflows/unified_evals.yml`. pass@k = | **macro** | **0.467** | **0.379** | | | **micro** | **0.394** | **0.308** | | -Run [29430259116](https://github.com/langchain-ai/deepagents/actions/runs/29430259116) · 2026-07-15 · `agent_impl=bare` · `profile=full` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` +Run [29430259116](https://github.com/langchain-ai/deepagents/actions/runs/29430259116) · 2026-07-15 · `agent_impl=bare` · `profile=full` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` · wall ~4h autonomous includes 14 of 246 trials that errored (agent/verifier timeouts and one OOM) and are scored as failures. Aggregated from the run's artifacts (one shard recovered from the retry attempt); no tasks were re-run. +### Lite + +Frozen high-signal subset (`lite_tasks.py`, difficulty-frontier tasks). + +| Category | pass@k | avg@k | tasks | +| --- | --- | --- | --- | +| autonomous (harbor-index) | 0.400 | 0.222 | 15 | +| conversation (tau3-subset) | 0.545 | 0.333 | 11 | +| context (context-retrieval) | 0.375 | 0.250 | 8 | +| **macro** | **0.440** | **0.269** | | +| **micro** | **0.441** | **0.265** | | + +Run [29451389710](https://github.com/langchain-ai/deepagents/actions/runs/29451389710) · 2026-07-15 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` · wall ~1h + ## openai:gpt-5.6-luna ### Full (default) From befe0160b6ec0174e7e1cc82776b99ee3d8852a9 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Thu, 16 Jul 2026 10:59:35 -0400 Subject: [PATCH 44/48] chore(evals): swap two slow tasks out of the lite autonomous subset replicationbench-find-galactic-vz-peaks (naive big-data script hits the 1h per-command timeout; ~65m observed) and usaco-assign-cows-to-barns (~27m) defeated lite's low-cost goal. Replaced with gpqadiamond-cope-rearrangement- products and swesmith-fix-oauth1-header-params (both <5m, partial-pass frontier on gpt-5.6-terra). Count stays 15. --- .github/scripts/lite_tasks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/scripts/lite_tasks.py b/.github/scripts/lite_tasks.py index e6ce3debb0f..3145c707031 100644 --- a/.github/scripts/lite_tasks.py +++ b/.github/scripts/lite_tasks.py @@ -20,11 +20,16 @@ # Excludes the bix* bioinformatics tasks: their ~6 GB `chenzizhao/bixbench` # image exhausts the Docker-sandbox runner disk (and fails the LangSmith # builder). Re-add once lite runs on a sandbox that builds big images. + # `gpqadiamond-cope-rearrangement-products` and `swesmith-fix-oauth1-header-params` + # replaced `replicationbench-find-galactic-vz-peaks` and `usaco-assign-cows-to-barns`: + # both originals could run ~30-65 min (replicationbench's naive big-data script + # hits the 1h per-command timeout), defeating lite's low-cost goal. The swaps are + # <5 min and still frontier (partial-pass), re-picked on gpt-5.6-terra timing+signal. "autonomous": [ - "harbor-index/replicationbench-find-galactic-vz-peaks", + "harbor-index/gpqadiamond-cope-rearrangement-products", "harbor-index/swebenchverified-fix-span-selector-axes-limits", "harbor-index/omnimath-find-perfect-square-functions", - "harbor-index/usaco-assign-cows-to-barns", + "harbor-index/swesmith-fix-oauth1-header-params", "harbor-index/featurebench-add-feature-mlflow-bedrock-autolog", "harbor-index/build-word2vec-pipeline", "harbor-index/tb-dna-insert", From 05b480f4918a9e0cee1415f6af950aa18d4af3ba Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Thu, 16 Jul 2026 11:12:09 -0400 Subject: [PATCH 45/48] ci(evals): wait out a not-ready Docker daemon before the harbor run GH-hosted runners intermittently have the Docker daemon not-yet-ready at job start, hard-failing a shard with 'Docker daemon is not running'. Add a docker-sandbox-only preflight that polls 'docker info' for up to ~120s so a startup race no longer loses an otherwise-good shard. Wait-only (no sudo/start, per the no-privilege-escalation-in-workflows policy). --- .github/workflows/_harbor_run.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/_harbor_run.yml b/.github/workflows/_harbor_run.yml index db4058939a5..892606ec0ac 100644 --- a/.github/workflows/_harbor_run.yml +++ b/.github/workflows/_harbor_run.yml @@ -447,6 +447,27 @@ jobs: fi uv run python -m harbor_adapters.contextbench.main --populate "$HARBOR_DATASET_PATH" + - name: "🐳 Wait for the Docker daemon" + # GH-hosted runners intermittently have the Docker daemon not-yet-ready at + # job start; harbor's docker sandbox then hard-fails with "Docker daemon is + # not running", losing an otherwise-good shard. Wait it out (docker-sandbox + # only). No sudo/start: the codebase disallows privilege escalation in + # workflows, and this targets the startup race, not a dead daemon (which + # still fails the shard, but the aggregator no longer voids the scorecard + # for a single missing shard). + if: ${{ inputs.sandbox_env == 'docker' }} + run: | + for i in $(seq 1 60); do + if docker info >/dev/null 2>&1; then + echo "Docker daemon ready (after ${i} check(s))." + exit 0 + fi + sleep 2 + done + echo "::error::Docker daemon not ready after ~120s." + docker info || true + exit 1 + - name: "⚓ Run Harbor" env: ANTHROPIC_API_KEY: ${{ startsWith(matrix.model, 'anthropic:') && secrets.ANTHROPIC_API_KEY || '' }} From aed72154be49dd511ed869681f45119edfbd3e14 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Thu, 16 Jul 2026 12:02:31 -0400 Subject: [PATCH 46/48] docs(evals): refresh terra + luna lite scorecards for the new task set Re-ran lite (new autonomous subset) for both models. terra lite macro pass@3 0.584 (autonomous 0.400, conversation 0.727, context 0.625); luna lite macro 0.369. terra conversation recovered from a transient Docker-daemon shard failure by merging the run's artifacts (no tasks re-run); luna clean. Wall ~25m / ~50m. --- libs/evals/UNIFIED_SCORECARD.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/libs/evals/UNIFIED_SCORECARD.md b/libs/evals/UNIFIED_SCORECARD.md index 3721d01ba80..5301b300ea3 100644 --- a/libs/evals/UNIFIED_SCORECARD.md +++ b/libs/evals/UNIFIED_SCORECARD.md @@ -24,13 +24,15 @@ Frozen high-signal subset (`lite_tasks.py`, difficulty-frontier tasks). | Category | pass@k | avg@k | tasks | | --- | --- | --- | --- | -| autonomous (harbor-index) | 0.400 | 0.222 | 15 | -| conversation (tau3-subset) | 0.545 | 0.333 | 11 | -| context (context-retrieval) | 0.375 | 0.250 | 8 | -| **macro** | **0.440** | **0.269** | | -| **micro** | **0.441** | **0.265** | | +| autonomous (harbor-index) | 0.400 | 0.267 | 15 | +| conversation (tau3-subset) | 0.727 | 0.455 | 11 | +| context (context-retrieval) | 0.625 | 0.375 | 8 | +| **macro** | **0.584** | **0.365** | | +| **micro** | **0.559** | **0.353** | | -Run [29451389710](https://github.com/langchain-ai/deepagents/actions/runs/29451389710) · 2026-07-15 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` · wall ~1h +Run [29509108062](https://github.com/langchain-ai/deepagents/actions/runs/29509108062) · 2026-07-16 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` · wall ~25m + +One conversation shard hit a transient Docker-daemon failure; recovered from the run's artifacts (merged the retried shard), no tasks re-run. ## openai:gpt-5.6-luna @@ -52,10 +54,10 @@ Frozen high-signal subset (`lite_tasks.py`, difficulty-frontier tasks). | Category | pass@k | avg@k | tasks | | --- | --- | --- | --- | -| autonomous (harbor-index) | 0.400 | 0.156 | 15 | -| conversation (tau3-subset) | 0.273 | 0.212 | 11 | -| context (context-retrieval) | 0.375 | 0.125 | 8 | -| **macro** | **0.349** | **0.164** | | -| **micro** | **0.353** | **0.167** | | +| autonomous (harbor-index) | 0.333 | 0.178 | 15 | +| conversation (tau3-subset) | 0.273 | 0.182 | 11 | +| context (context-retrieval) | 0.500 | 0.333 | 8 | +| **macro** | **0.369** | **0.231** | | +| **micro** | **0.353** | **0.216** | | -Run [29304843581](https://github.com/langchain-ai/deepagents/actions/runs/29304843581) · 2026-07-14 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`af2e862` \ No newline at end of file +Run [29509109809](https://github.com/langchain-ai/deepagents/actions/runs/29509109809) · 2026-07-16 · `agent_impl=bare` · `profile=lite` · rollouts=3 · `sandbox=docker` · `judge=gpt-5.6-luna` · harbor@`27a6eac` · wall ~50m \ No newline at end of file From fcbb777761a6c0d98e1a9826b355213741b8c260 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Thu, 16 Jul 2026 16:16:55 -0400 Subject: [PATCH 47/48] fix(evals): budget packed shards at full concurrency --- .github/scripts/test_unified_prep.py | 63 ++++++++++++++----- .../scripts/test_validate_harbor_limits.py | 15 ++++- .github/scripts/unified_prep.py | 34 +++++----- .github/scripts/validate_harbor_limits.py | 39 ++++++------ .github/workflows/harbor.yml | 4 +- 5 files changed, 99 insertions(+), 56 deletions(-) diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 542eda9f265..c57993db89e 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -23,12 +23,15 @@ def test_provider_of_uses_prefix_and_falls_back_to_other(): def test_derive_pool_from_concurrency_and_rollouts(): - # concurrency 4, rollouts 3 -> per_shard=3 -> 40//3=13 ; 80//13=6 - assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (13, 1) - # concurrency 1 -> per_shard=1 -> 40 ; 80//40=2 - assert up.derive_pool(concurrency=1, rollouts=3, n_shards=100, n_models=5) == (40, 2) - # rollouts < concurrency clamps per_shard to rollouts (the utilization win) - assert up.derive_pool(concurrency=4, rollouts=2, n_shards=100, n_models=1)[0] == 20 + # Packed shards can use all 4 slots: 40//4=10; 80//10=8. + assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (10, 1) + # concurrency 1 -> 40 shard jobs; 80//40=2 models + assert up.derive_pool(concurrency=1, rollouts=3, n_shards=100, n_models=5) == ( + 40, + 2, + ) + # Lower rollouts do not reduce a packed shard's peak concurrency. + assert up.derive_pool(concurrency=4, rollouts=2, n_shards=100, n_models=1)[0] == 10 # clamp max_parallel to n_shards when few tasks; model_parallel clamps to n_models assert up.derive_pool(concurrency=1, rollouts=3, n_shards=8, n_models=1) == (8, 1) @@ -130,6 +133,7 @@ def test_total_job_guard_allows_within_budget(): def test_total_job_guard_rejects_over_budget(): import pytest + with pytest.raises(SystemExit, match=r"worker pool"): up.total_job_guard(n_models=3, shards_per_model=142) # 426 > 400 @@ -147,7 +151,9 @@ def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch) up.build_flat_matrix("x:y", ["autonomous"], {"autonomous": ["t"] * n_tasks}) ) assert packed == 130 # pins the packing so the budget arithmetic below is real - assert 3 * packed <= up.TOTAL_JOB_BUDGET < 3 * min(n_tasks, up.shard_matrix.MAX_SHARDS) + assert ( + 3 * packed <= up.TOTAL_JOB_BUDGET < 3 * min(n_tasks, up.shard_matrix.MAX_SHARDS) + ) tasks_json = tmp_path / "tasks.json" tasks_json.write_text( @@ -160,7 +166,9 @@ def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch) monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) assert up.main([]) == 0 # SystemExit if the guard over-counts (raw or loose bound) - lines = dict(line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines()) + lines = dict( + line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines() + ) entries = _j.loads(lines["eval_matrix"])["include"] assert len(entries) == 3 for entry in entries: @@ -204,13 +212,19 @@ def test_build_flat_matrix_defaults_to_bare(): def test_build_flat_matrix_conversation_stays_tau3(): tasks = {"conversation": ["sierra-research/tau3-bench__x"]} - entries = up.build_flat_matrix("openai:gpt", ["conversation"], tasks, code_impl="bare") + entries = up.build_flat_matrix( + "openai:gpt", ["conversation"], tasks, code_impl="bare" + ) assert entries[0]["agent_impl"] == "tau3" def test_build_flat_matrix_packs_above_cap(): - tasks = {"autonomous": [f"harbor-index/t{i}" for i in range(shard_matrix.MAX_SHARDS + 5)]} - entries = up.build_flat_matrix("openai:gpt", ["autonomous"], tasks, code_impl="dcode") + tasks = { + "autonomous": [f"harbor-index/t{i}" for i in range(shard_matrix.MAX_SHARDS + 5)] + } + entries = up.build_flat_matrix( + "openai:gpt", ["autonomous"], tasks, code_impl="dcode" + ) assert len(entries) <= shard_matrix.MAX_SHARDS # every task still present, split across include_tasks strings seen = " ".join(e["include_tasks"] for e in entries).split() @@ -227,7 +241,10 @@ def test_build_flat_matrix_bounds_per_model_total_across_categories(): "context": [f"cb-cloud-{i}" for i in range(40)], } entries = up.build_flat_matrix( - "openai:gpt", ["autonomous", "conversation", "context"], tasks, code_impl="dcode" + "openai:gpt", + ["autonomous", "conversation", "context"], + tasks, + code_impl="dcode", ) assert len(entries) <= shard_matrix.MAX_SHARDS for cat, expected in tasks.items(): @@ -236,6 +253,18 @@ def test_build_flat_matrix_bounds_per_model_total_across_categories(): assert seen == expected # every task present exactly once, order preserved +def test_derive_pool_budgets_packed_shards_at_full_concurrency(): + tasks = {"autonomous": [f"harbor-index/a{i}" for i in range(260)]} + entries = up.build_flat_matrix("openai:gpt", ["autonomous"], tasks) + assert any(len(entry["include_tasks"].split()) > 1 for entry in entries) + + max_parallel, _ = up.derive_pool( + concurrency=4, rollouts=3, n_shards=len(entries), n_models=1 + ) + assert max_parallel == 10 + assert max_parallel * 4 == up.MAX_TASKS_PER_MODEL + + def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): # Lite-like: total is well under MAX_SHARDS, so behavior is unchanged — # one task per matrix entry, no packing. @@ -245,7 +274,10 @@ def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): "context": [f"cb-cloud-{i}" for i in range(8)], } entries = up.build_flat_matrix( - "openai:gpt", ["autonomous", "conversation", "context"], tasks, code_impl="dcode" + "openai:gpt", + ["autonomous", "conversation", "context"], + tasks, + code_impl="dcode", ) assert len(entries) == 15 + 11 + 8 assert all(len(e["include_tasks"].split()) == 1 for e in entries) @@ -253,6 +285,7 @@ def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): import json as _j + out = tmp_path / "o" monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt, anthropic:opus") monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous,conversation,context") @@ -262,8 +295,8 @@ def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): monkeypatch.setenv("GITHUB_OUTPUT", str(out)) assert up.main([]) == 0 lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) - assert lines["max_parallel"] == "13" # conc4,roll3 -> 40//3 - assert lines["model_parallel"] == "2" # 80//13=6 -> min(6, 2 models) + assert lines["max_parallel"] == "10" # conc4 -> 40//4 + assert lines["model_parallel"] == "2" # 80//10=8 -> min(8, 2 models) eval_matrix = _j.loads(lines["eval_matrix"])["include"] assert len(eval_matrix) == 2 # one entry per model assert {e["model"] for e in eval_matrix} == {"openai:gpt", "anthropic:opus"} diff --git a/.github/scripts/test_validate_harbor_limits.py b/.github/scripts/test_validate_harbor_limits.py index 2c7fd594952..c5beaf369c9 100644 --- a/.github/scripts/test_validate_harbor_limits.py +++ b/.github/scripts/test_validate_harbor_limits.py @@ -91,14 +91,23 @@ def test_parse_positive_accepts_valid(mod: ModuleType) -> None: def test_derive_shard_parallel_saturates_pool_and_clamps_to_n_shards( mod: ModuleType, ) -> None: - # per_shard = min(4, 3) = 3; 40 // 3 = 13, well under n_shards=100. - assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=100) == 13 + # Packed shards can use all 4 slots; 40 // 4 = 10, under n_shards=100. + assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=100) == 10 # Same concurrency/rollouts, but n_shards=5 clamps the pool down to 5. assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=5) == 5 - # per_shard = min(1, 3) = 1; 40 // 1 = 40, the full budget. + # concurrency 1 allows 40 shard jobs, using the full budget. assert mod.derive_shard_parallel(concurrency=1, rollouts=3, n_shards=100) == 40 +def test_derive_shard_parallel_uses_concurrency_when_rollouts_are_lower( + mod: ModuleType, +) -> None: + """Multiple tasks let a shard fill concurrency beyond one task's rollouts.""" + pool = mod.derive_shard_parallel(concurrency=4, rollouts=2, n_shards=100) + assert pool == 10 + assert pool * 4 == mod.MAX_TASKS_PER_MODEL + + def test_derive_shard_parallel_unchanged_at_todays_n_shards_10(mod: ModuleType) -> None: """No-change property: at n_shards=10 with today's typical inputs, the derived shard_parallel equals n_shards itself — identical to the current diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 417be90d185..11f7629a12a 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -2,13 +2,13 @@ Parses a free-form comma-separated model CSV, validates it via models.py, maps each category to its Harbor dataset, and emits a per-model flat matrix -(one entry per single-task shard, spanning every category) to GITHUB_OUTPUT. +(one entry per shard, spanning every category) to GITHUB_OUTPUT. Pool sizing is derived by `derive_pool`, not clamped after the fact: given -`concurrency` (trials in flight per task) and `rollouts` (trials per task), -`per_shard = min(concurrency, rollouts)` is the peak concurrent trials a -single 1-task shard ever runs. `max_parallel = MAX_TASKS_PER_MODEL // -per_shard` saturates the per-model 40-trial budget, and `model_parallel = +`concurrency` (trials in flight per shard job), `max_parallel = +MAX_TASKS_PER_MODEL // concurrency` saturates the per-model 40-trial budget. +Using the full concurrency is necessary because packed shards can contain +multiple tasks. `model_parallel = MAX_RUNNERS // max_parallel` bounds how many models run at once so total runners stay within MAX_RUNNERS. Both invariants hold by construction: per model: concurrency * max_parallel <= MAX_TASKS_PER_MODEL (40) @@ -150,16 +150,16 @@ def provider_of(spec: str, known: set[str] = KNOWN_PROVIDERS) -> str: def derive_pool( concurrency: int, rollouts: int, n_shards: int, n_models: int ) -> tuple[int, int]: - """Derive (max_parallel, model_parallel) from concurrency and rollouts. + """Derive (max_parallel, model_parallel) from the requested run limits. - per_shard is the peak concurrent trials in one 1-task shard, which a shard - can never exceed: min(concurrency, rollouts). max_parallel saturates the - per-model 40-trial budget; model_parallel bounds how many models run at once - so total runners stay within MAX_RUNNERS. Both hold the invariants by - construction, so no separate clamp/assert is needed. + A packed shard can run multiple tasks and therefore use its full + `concurrency` even when `rollouts` is lower. `max_parallel` saturates the + per-model 40-trial budget; `model_parallel` bounds how many models run at + once so total runners stay within `MAX_RUNNERS`. `rollouts` remains in the + signature for compatibility with callers that supply all run limits. """ - per_shard = max(1, min(concurrency, rollouts)) - max_parallel = max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + del rollouts + max_parallel = max(1, min(MAX_TASKS_PER_MODEL // max(1, concurrency), n_shards)) model_parallel = max(1, min(MAX_RUNNERS // max_parallel, n_models)) return max_parallel, model_parallel @@ -311,7 +311,9 @@ def main(argv: list[str] | None = None) -> int: else: tasks_json = os.environ.get("UNIFIED_TASKS_JSON", "").strip() if not tasks_json: - raise SystemExit("full profile requires UNIFIED_TASKS_JSON (enumerated tasks).") + raise SystemExit( + "full profile requires UNIFIED_TASKS_JSON (enumerated tasks)." + ) with open(tasks_json) as f: tasks_by_cat = json.load(f) @@ -333,7 +335,9 @@ def main(argv: list[str] | None = None) -> int: # n_shards for the pool = number of single-task shards (pre-pack); derive pool. n_shards = est_tasks - max_parallel, model_parallel = derive_pool(concurrency, rollouts, n_shards, n_models) + max_parallel, model_parallel = derive_pool( + concurrency, rollouts, n_shards, n_models + ) outputs: dict[str, object] = { # The expected grid, so the combiner can flag missing/incomplete leaves diff --git a/.github/scripts/validate_harbor_limits.py b/.github/scripts/validate_harbor_limits.py index b5dc605d535..656de615629 100644 --- a/.github/scripts/validate_harbor_limits.py +++ b/.github/scripts/validate_harbor_limits.py @@ -11,11 +11,11 @@ be set as high as the task count (one task per shard) for dynamic dispatch. Instead, the derived `shard_parallel` (the pool the shards drain through) is what's bounded, alongside the per-shard concurrent-trial count: `shard_parallel - * min(concurrency, rollouts) <= 40`. + * concurrency <= 40`. This module owns the derivation of `shard_parallel` for the single-model case: -`shard_parallel = min(MAX_TASKS_PER_MODEL // min(concurrency, rollouts), -n_shards)`, mirroring `unified_prep.derive_pool` (pinned together by +`shard_parallel = min(MAX_TASKS_PER_MODEL // concurrency, n_shards)`, mirroring +`unified_prep.derive_pool` (pinned together by `test_validate_harbor_limits.py`'s drift-guard test). `main()` emits it as `shard_parallel=` to `$GITHUB_OUTPUT` for `harbor.yml` to pass straight through to the leaf workflow's `shard_parallel` input. @@ -61,13 +61,12 @@ def derive_shard_parallel(concurrency: int, rollouts: int, n_shards: int) -> int """Derive the shard pool size the run job's shards drain through. Mirrors `unified_prep.derive_pool`'s `max_parallel` for a single model: - `per_shard = min(concurrency, rollouts)` is the peak concurrent trials one - 1-task shard ever runs; the pool saturates the per-model - `MAX_TASKS_PER_MODEL` (40) budget without exceeding `n_shards` itself (no - point pooling more than there are shards to drain). + each shard job can use its full `concurrency` when it contains multiple + tasks, even when `rollouts` is lower. The pool saturates the per-model + `MAX_TASKS_PER_MODEL` (40) budget without exceeding `n_shards` itself. """ - per_shard = max(1, min(concurrency, rollouts)) - return max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + del rollouts + return max(1, min(MAX_TASKS_PER_MODEL // max(1, concurrency), n_shards)) def validate_limits( @@ -83,25 +82,23 @@ def validate_limits( "(all/set0/frontier/...) and comma-separated overrides are not accepted." ) if n_shards > shard_matrix.MAX_SHARDS: - errors.append(f"n_shards={n_shards} exceeds the cap of {shard_matrix.MAX_SHARDS}") + errors.append( + f"n_shards={n_shards} exceeds the cap of {shard_matrix.MAX_SHARDS}" + ) if concurrency > MAX_CONCURRENCY: errors.append(f"concurrency={concurrency} exceeds the cap of {MAX_CONCURRENCY}") # Defensive, not user-facing: derive_shard_parallel's floor division makes - # this true by construction (never trips). Uses per_shard — the peak - # concurrent trials one 1-task shard actually runs, min(concurrency, - # rollouts) — rather than raw concurrency, since a shard with fewer - # rollouts than its concurrency setting can't use the extra slots (same - # per_shard substitution unified_prep.derive_pool's docstring describes - # loosely as "concurrency"). An explicit raise (never a bare `assert`, - # which `python -O` strips) so a formula regression fails loudly instead - # of silently over-provisioning sandboxes. + # this true by construction (never trips). A shard may contain multiple + # tasks, so its peak is the full concurrency even when each individual task + # has fewer rollouts. An explicit raise (never a bare `assert`, which + # `python -O` strips) makes a formula regression fail loudly instead of + # silently over-provisioning sandboxes. shard_parallel = derive_shard_parallel(concurrency, rollouts, n_shards) - per_shard = max(1, min(concurrency, rollouts)) - if shard_parallel * per_shard > MAX_TASKS_PER_MODEL: + if shard_parallel * concurrency > MAX_TASKS_PER_MODEL: msg = ( f"internal error: derived shard_parallel={shard_parallel} * " - f"per_shard={per_shard} exceeds {MAX_TASKS_PER_MODEL}" + f"concurrency={concurrency} exceeds {MAX_TASKS_PER_MODEL}" ) raise AssertionError(msg) return errors diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 186087e6702..ff2b71c074b 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -184,7 +184,7 @@ on: default: false type: boolean n_shards: - description: "Split the dataset's tasks across N shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). May be set as high as the task count (one task per shard) for dynamic dispatch — shards drain through a derived pool (shard_parallel), not all at once. Capped at 200 (shard_matrix.MAX_SHARDS); the pool is bounded so shard_parallel * min(concurrency, rollouts_per_task) <= 40 concurrent sandboxes." + description: "Split the dataset's tasks across N shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). May be set as high as the task count (one task per shard) for dynamic dispatch — shards drain through a derived pool (shard_parallel), not all at once. Capped at 200 (shard_matrix.MAX_SHARDS); the pool is bounded so shard_parallel * concurrency <= 40 concurrent sandboxes." required: false default: "10" type: string @@ -281,7 +281,7 @@ jobs: # concurrency <= 4). n_shards may be set high for dynamic dispatch (one # task per shard); shards drain through a derived shard_parallel pool # instead of all running at once, bounded so shard_parallel * - # min(concurrency, rollouts) <= 40 concurrent sandboxes. Inputs are read + # concurrency <= 40 concurrent sandboxes. Inputs are read # via env (no shell interpolation) and int-parsed in the script. # See validate_harbor_limits.py (unit-tested in test_validate_harbor_limits.py). id: limits From 61a5f27e1d2ebd0ae3ce724802dc7a7f6df8f848 Mon Sep 17 00:00:00 2001 From: Nick Hollon Date: Thu, 16 Jul 2026 17:13:26 -0400 Subject: [PATCH 48/48] fix(evals): harden unified eval integrity checks --- .github/scripts/aggregate_unified.py | 3 + .github/scripts/test_aggregate_unified.py | 31 +++-- .github/scripts/test_unified_prep.py | 117 +++++++++++++++--- .../scripts/test_validate_harbor_limits.py | 15 ++- .github/scripts/unified_prep.py | 87 +++++++++---- .github/scripts/validate_harbor_limits.py | 39 +++--- .github/workflows/harbor.yml | 4 +- 7 files changed, 221 insertions(+), 75 deletions(-) diff --git a/.github/scripts/aggregate_unified.py b/.github/scripts/aggregate_unified.py index 25a0452664f..0c263b99d68 100644 --- a/.github/scripts/aggregate_unified.py +++ b/.github/scripts/aggregate_unified.py @@ -373,6 +373,9 @@ def main(argv: list[str] | None = None) -> int: write_outputs( combined, args.rollouts, out_dir, os.environ.get("GITHUB_STEP_SUMMARY") ) + if not leaves: + print("::error::No usable eval leaf summaries were found; failing the run.") + return 1 # Incompleteness is surfaced per model in write_outputs (a ::warning:: plus the # ⚠️ markers in the table) and never fails the job: a partial scorecard the # reader can inspect beats a voided run with no output. A single errored shard diff --git a/.github/scripts/test_aggregate_unified.py b/.github/scripts/test_aggregate_unified.py index 07f341dcb79..25acf0f2f2f 100644 --- a/.github/scripts/test_aggregate_unified.py +++ b/.github/scripts/test_aggregate_unified.py @@ -492,27 +492,39 @@ def test_main_rejects_nonpositive_rollouts( assert "--rollouts must be >= 1" in capsys.readouterr().err -def test_main_warns_but_succeeds_when_every_expected_model_is_incomplete( +def test_main_fails_when_no_usable_leaf_summaries_exist( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], ) -> None: - # An incomplete run must still produce a usable scorecard (exit 0) rather than - # voiding everything; the incompleteness is surfaced as a warning. monkeypatch.setenv("EXPECTED_MODELS", '["m"]') monkeypatch.setenv("EXPECTED_CATEGORIES", '["context"]') out = tmp_path / "combined" rc = au.main([str(tmp_path), "--rollouts", "3", "--out-dir", str(out)]) - assert rc == 0 + assert rc == 1 assert (out / "unified_summary.json").exists() - assert "::warning::All expected models were flagged incomplete" in ( - capsys.readouterr().out + assert ( + "::error::No usable eval leaf summaries were found" in capsys.readouterr().out ) + +def test_main_warns_but_succeeds_when_usable_leaves_are_incomplete( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + capsys: pytest.CaptureFixture[str], +) -> None: + monkeypatch.setenv("EXPECTED_MODELS", '["m"]') + monkeypatch.setenv("EXPECTED_CATEGORIES", '["context", "autonomous"]') _leaf_dir(tmp_path, "m", "context") - assert au.main([str(tmp_path), "--rollouts", "3", "--out-dir", str(out)]) == 0 + + rc = au.main([str(tmp_path), "--rollouts", "3"]) + + assert rc == 0 + assert "::warning::All expected models were flagged incomplete" in ( + capsys.readouterr().out + ) def test_main_warns_when_required_leaf_has_no_tasks( @@ -581,7 +593,7 @@ def test_main_does_not_apply_expected_grid_failure_without_expected_models( assert "::error::Every expected model is incomplete" not in output -def test_main_warns_and_skips_leaf_with_mismatched_rollouts( +def test_main_fails_when_all_leaves_have_mismatched_rollouts( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str], @@ -596,8 +608,9 @@ def test_main_warns_and_skips_leaf_with_mismatched_rollouts( output = capsys.readouterr().out combined = json.loads((out / "unified_summary.json").read_text()) - assert rc == 0 + assert rc == 1 assert "rollouts_per_task is 2; expected 3" in output + assert "::error::No usable eval leaf summaries were found" in output assert combined["models"]["m"]["missing_categories"] == ["context"] diff --git a/.github/scripts/test_unified_prep.py b/.github/scripts/test_unified_prep.py index 542eda9f265..8ac59dc8a28 100644 --- a/.github/scripts/test_unified_prep.py +++ b/.github/scripts/test_unified_prep.py @@ -1,6 +1,8 @@ import os import sys +import pytest + sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import shard_matrix # noqa: E402 import unified_prep as up # noqa: E402 @@ -22,17 +24,80 @@ def test_provider_of_uses_prefix_and_falls_back_to_other(): assert up.provider_of("weirdvendor:x", known) == "other" -def test_derive_pool_from_concurrency_and_rollouts(): - # concurrency 4, rollouts 3 -> per_shard=3 -> 40//3=13 ; 80//13=6 - assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (13, 1) - # concurrency 1 -> per_shard=1 -> 40 ; 80//40=2 - assert up.derive_pool(concurrency=1, rollouts=3, n_shards=100, n_models=5) == (40, 2) - # rollouts < concurrency clamps per_shard to rollouts (the utilization win) - assert up.derive_pool(concurrency=4, rollouts=2, n_shards=100, n_models=1)[0] == 20 - # clamp max_parallel to n_shards when few tasks; model_parallel clamps to n_models +def test_derive_pool_budgets_packed_shards_at_full_concurrency(): + # Packed shards can use all four slots: 40 // 4 = 10. + assert up.derive_pool(concurrency=4, rollouts=3, n_shards=34, n_models=1) == (10, 1) + # concurrency 1 -> 40 shard jobs; 80 // 40 = 2 models. + assert up.derive_pool(concurrency=1, rollouts=3, n_shards=100, n_models=5) == ( + 40, + 2, + ) + # Lower rollouts do not reduce a packed shard's peak concurrency. + assert up.derive_pool(concurrency=4, rollouts=2, n_shards=100, n_models=1)[0] == 10 + # Clamp max_parallel to n_shards when few tasks; model_parallel clamps to n_models. assert up.derive_pool(concurrency=1, rollouts=3, n_shards=8, n_models=1) == (8, 1) +def test_allocate_shard_budgets_trims_overflow_from_largest_category(): + budgets = up._allocate_shard_budgets( + {"big": 10_000, "s1": 1, "s2": 1}, cap=shard_matrix.MAX_SHARDS + ) + + assert sum(budgets.values()) <= shard_matrix.MAX_SHARDS + assert budgets == {"big": 198, "s1": 1, "s2": 1} + + +def test_allocate_shard_budgets_breaks_largest_ties_by_category_order(): + budgets = up._allocate_shard_budgets( + {"first": 1_000, "second": 1_000, "small-1": 1, "small-2": 1, "small-3": 1}, + cap=shard_matrix.MAX_SHARDS, + ) + + assert sum(budgets.values()) <= shard_matrix.MAX_SHARDS + assert budgets == { + "first": 98, + "second": 99, + "small-1": 1, + "small-2": 1, + "small-3": 1, + } + + +def test_main_rejects_empty_requested_category(tmp_path, monkeypatch): + import json as _j + import pytest + + tasks_json = tmp_path / "tasks.json" + tasks_json.write_text(_j.dumps({"autonomous": []})) + monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") + monkeypatch.setenv("UNIFIED_PROFILE", "full") + monkeypatch.setenv("UNIFIED_TASKS_JSON", str(tasks_json)) + monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) + + with pytest.raises(SystemExit, match=r"No tasks resolved for requested categor"): + up.main([]) + + +@pytest.mark.parametrize( + "tasks", [{"autonomous": "taskname"}, ["taskname"], {"autonomous": ["task", 1]}] +) +def test_main_rejects_invalid_full_task_json_shape(tmp_path, monkeypatch, tasks): + import json as _j + import pytest + + tasks_json = tmp_path / "tasks.json" + tasks_json.write_text(_j.dumps(tasks)) + monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt") + monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous") + monkeypatch.setenv("UNIFIED_PROFILE", "full") + monkeypatch.setenv("UNIFIED_TASKS_JSON", str(tasks_json)) + monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) + + with pytest.raises(SystemExit, match=r"UNIFIED_TASKS_JSON must be a JSON object"): + up.main([]) + + def test_main_rejects_invalid_agent_impl(tmp_path, monkeypatch): import pytest @@ -130,6 +195,7 @@ def test_total_job_guard_allows_within_budget(): def test_total_job_guard_rejects_over_budget(): import pytest + with pytest.raises(SystemExit, match=r"worker pool"): up.total_job_guard(n_models=3, shards_per_model=142) # 426 > 400 @@ -147,7 +213,9 @@ def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch) up.build_flat_matrix("x:y", ["autonomous"], {"autonomous": ["t"] * n_tasks}) ) assert packed == 130 # pins the packing so the budget arithmetic below is real - assert 3 * packed <= up.TOTAL_JOB_BUDGET < 3 * min(n_tasks, up.shard_matrix.MAX_SHARDS) + assert ( + 3 * packed <= up.TOTAL_JOB_BUDGET < 3 * min(n_tasks, up.shard_matrix.MAX_SHARDS) + ) tasks_json = tmp_path / "tasks.json" tasks_json.write_text( @@ -160,7 +228,9 @@ def test_main_full_multi_model_guard_counts_packed_shards(tmp_path, monkeypatch) monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path / "o")) assert up.main([]) == 0 # SystemExit if the guard over-counts (raw or loose bound) - lines = dict(line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines()) + lines = dict( + line.split("=", 1) for line in (tmp_path / "o").read_text().splitlines() + ) entries = _j.loads(lines["eval_matrix"])["include"] assert len(entries) == 3 for entry in entries: @@ -204,13 +274,19 @@ def test_build_flat_matrix_defaults_to_bare(): def test_build_flat_matrix_conversation_stays_tau3(): tasks = {"conversation": ["sierra-research/tau3-bench__x"]} - entries = up.build_flat_matrix("openai:gpt", ["conversation"], tasks, code_impl="bare") + entries = up.build_flat_matrix( + "openai:gpt", ["conversation"], tasks, code_impl="bare" + ) assert entries[0]["agent_impl"] == "tau3" def test_build_flat_matrix_packs_above_cap(): - tasks = {"autonomous": [f"harbor-index/t{i}" for i in range(shard_matrix.MAX_SHARDS + 5)]} - entries = up.build_flat_matrix("openai:gpt", ["autonomous"], tasks, code_impl="dcode") + tasks = { + "autonomous": [f"harbor-index/t{i}" for i in range(shard_matrix.MAX_SHARDS + 5)] + } + entries = up.build_flat_matrix( + "openai:gpt", ["autonomous"], tasks, code_impl="dcode" + ) assert len(entries) <= shard_matrix.MAX_SHARDS # every task still present, split across include_tasks strings seen = " ".join(e["include_tasks"] for e in entries).split() @@ -227,7 +303,10 @@ def test_build_flat_matrix_bounds_per_model_total_across_categories(): "context": [f"cb-cloud-{i}" for i in range(40)], } entries = up.build_flat_matrix( - "openai:gpt", ["autonomous", "conversation", "context"], tasks, code_impl="dcode" + "openai:gpt", + ["autonomous", "conversation", "context"], + tasks, + code_impl="dcode", ) assert len(entries) <= shard_matrix.MAX_SHARDS for cat, expected in tasks.items(): @@ -245,7 +324,10 @@ def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): "context": [f"cb-cloud-{i}" for i in range(8)], } entries = up.build_flat_matrix( - "openai:gpt", ["autonomous", "conversation", "context"], tasks, code_impl="dcode" + "openai:gpt", + ["autonomous", "conversation", "context"], + tasks, + code_impl="dcode", ) assert len(entries) == 15 + 11 + 8 assert all(len(e["include_tasks"].split()) == 1 for e in entries) @@ -253,6 +335,7 @@ def test_build_flat_matrix_below_cap_stays_one_task_per_shard(): def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): import json as _j + out = tmp_path / "o" monkeypatch.setenv("UNIFIED_MODELS", "openai:gpt, anthropic:opus") monkeypatch.setenv("UNIFIED_CATEGORIES", "autonomous,conversation,context") @@ -262,8 +345,8 @@ def test_main_emits_per_model_flat_matrix_lite(tmp_path, monkeypatch): monkeypatch.setenv("GITHUB_OUTPUT", str(out)) assert up.main([]) == 0 lines = dict(line.split("=", 1) for line in out.read_text().splitlines()) - assert lines["max_parallel"] == "13" # conc4,roll3 -> 40//3 - assert lines["model_parallel"] == "2" # 80//13=6 -> min(6, 2 models) + assert lines["max_parallel"] == "10" # conc4 -> 40//4 + assert lines["model_parallel"] == "2" # 80//10=8 -> min(8, 2 models) eval_matrix = _j.loads(lines["eval_matrix"])["include"] assert len(eval_matrix) == 2 # one entry per model assert {e["model"] for e in eval_matrix} == {"openai:gpt", "anthropic:opus"} diff --git a/.github/scripts/test_validate_harbor_limits.py b/.github/scripts/test_validate_harbor_limits.py index 2c7fd594952..a9e29c02ae4 100644 --- a/.github/scripts/test_validate_harbor_limits.py +++ b/.github/scripts/test_validate_harbor_limits.py @@ -91,14 +91,23 @@ def test_parse_positive_accepts_valid(mod: ModuleType) -> None: def test_derive_shard_parallel_saturates_pool_and_clamps_to_n_shards( mod: ModuleType, ) -> None: - # per_shard = min(4, 3) = 3; 40 // 3 = 13, well under n_shards=100. - assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=100) == 13 + # Packed shards can use all 4 slots; 40 // 4 = 10, under n_shards=100. + assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=100) == 10 # Same concurrency/rollouts, but n_shards=5 clamps the pool down to 5. assert mod.derive_shard_parallel(concurrency=4, rollouts=3, n_shards=5) == 5 - # per_shard = min(1, 3) = 1; 40 // 1 = 40, the full budget. + # concurrency 1 allows 40 shard jobs, using the full budget. assert mod.derive_shard_parallel(concurrency=1, rollouts=3, n_shards=100) == 40 +def test_derive_shard_parallel_uses_concurrency_when_rollouts_are_lower( + mod: ModuleType, +) -> None: + pool = mod.derive_shard_parallel(concurrency=4, rollouts=2, n_shards=100) + + assert pool == 10 + assert pool * 4 == mod.MAX_TASKS_PER_MODEL + + def test_derive_shard_parallel_unchanged_at_todays_n_shards_10(mod: ModuleType) -> None: """No-change property: at n_shards=10 with today's typical inputs, the derived shard_parallel equals n_shards itself — identical to the current diff --git a/.github/scripts/unified_prep.py b/.github/scripts/unified_prep.py index 417be90d185..14611606059 100644 --- a/.github/scripts/unified_prep.py +++ b/.github/scripts/unified_prep.py @@ -5,12 +5,12 @@ (one entry per single-task shard, spanning every category) to GITHUB_OUTPUT. Pool sizing is derived by `derive_pool`, not clamped after the fact: given -`concurrency` (trials in flight per task) and `rollouts` (trials per task), -`per_shard = min(concurrency, rollouts)` is the peak concurrent trials a -single 1-task shard ever runs. `max_parallel = MAX_TASKS_PER_MODEL // -per_shard` saturates the per-model 40-trial budget, and `model_parallel = -MAX_RUNNERS // max_parallel` bounds how many models run at once so total -runners stay within MAX_RUNNERS. Both invariants hold by construction: +`concurrency` (trials in flight per shard job), `max_parallel = +MAX_TASKS_PER_MODEL // concurrency` saturates the per-model 40-trial budget. +Using full concurrency is necessary because packed shards can contain multiple +tasks. `model_parallel = MAX_RUNNERS // max_parallel` bounds how many models +run at once so total runners stay within MAX_RUNNERS. Both invariants hold by +construction: per model: concurrency * max_parallel <= MAX_TASKS_PER_MODEL (40) global: model_parallel * max_parallel <= MAX_RUNNERS (80) `total_job_guard` separately caps the total job count (n_models * shards @@ -23,6 +23,7 @@ import json import os import sys +from typing import cast sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import lite_tasks # noqa: E402 (lite_tasks.py in same dir) @@ -150,20 +151,38 @@ def provider_of(spec: str, known: set[str] = KNOWN_PROVIDERS) -> str: def derive_pool( concurrency: int, rollouts: int, n_shards: int, n_models: int ) -> tuple[int, int]: - """Derive (max_parallel, model_parallel) from concurrency and rollouts. + """Derive (max_parallel, model_parallel) from the requested run limits. - per_shard is the peak concurrent trials in one 1-task shard, which a shard - can never exceed: min(concurrency, rollouts). max_parallel saturates the - per-model 40-trial budget; model_parallel bounds how many models run at once - so total runners stay within MAX_RUNNERS. Both hold the invariants by - construction, so no separate clamp/assert is needed. + A packed shard can run multiple tasks and therefore use its full + `concurrency` even when `rollouts` is lower. `max_parallel` saturates the + per-model 40-trial budget; `model_parallel` bounds how many models run at + once so total runners stay within `MAX_RUNNERS`. `rollouts` remains in the + signature for compatibility with callers that supply all run limits. """ - per_shard = max(1, min(concurrency, rollouts)) - max_parallel = max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + del rollouts + max_parallel = max(1, min(MAX_TASKS_PER_MODEL // max(1, concurrency), n_shards)) model_parallel = max(1, min(MAX_RUNNERS // max_parallel, n_models)) return max_parallel, model_parallel +def _load_tasks_json(path: str) -> dict[str, list[str]]: + """Load the full-profile task mapping from an enumerated JSON file.""" + msg = "UNIFIED_TASKS_JSON must be a JSON object mapping category names to lists of task strings" + try: + with open(path) as f: + raw: object = json.load(f) + except json.JSONDecodeError as exc: + raise SystemExit(msg) from exc + if not isinstance(raw, dict) or not all( + isinstance(category, str) + and isinstance(tasks, list) + and all(isinstance(task, str) for task in tasks) + for category, tasks in raw.items() + ): + raise SystemExit(msg) + return cast(dict[str, list[str]], raw) + + def _allocate_shard_budgets(counts: dict[str, int], cap: int) -> dict[str, int]: """Split `cap` shards across categories proportional to `counts`. @@ -311,12 +330,21 @@ def main(argv: list[str] | None = None) -> int: else: tasks_json = os.environ.get("UNIFIED_TASKS_JSON", "").strip() if not tasks_json: - raise SystemExit("full profile requires UNIFIED_TASKS_JSON (enumerated tasks).") - with open(tasks_json) as f: - tasks_by_cat = json.load(f) + raise SystemExit( + "full profile requires UNIFIED_TASKS_JSON (enumerated tasks)." + ) + tasks_by_cat = _load_tasks_json(tasks_json) + + empty_categories = [ + category for category in categories if not tasks_by_cat.get(category) + ] + if empty_categories: + raise SystemExit( + f"No tasks resolved for requested categor(y/ies): {empty_categories}" + ) n_models = len(model_specs) - est_tasks = max(sum(len(tasks_by_cat.get(c, [])) for c in categories), 1) + est_tasks = sum(len(tasks_by_cat[category]) for category in categories) # Jobs launched per model = the packed flat-matrix entry count, not the raw # task count: build_flat_matrix groups tasks into at most MAX_SHARDS shards, # and ceil-division packing usually yields fewer (e.g. 120+120+40 tasks pack @@ -324,16 +352,29 @@ def main(argv: list[str] | None = None) -> int: # once on the first model and guard on the real emitted job total. Guarding # on the raw task count would reject valid multi-model full runs whose packed # total is within budget (e.g. 3 models x 260 tasks -> 3 x 130 = 390 <= 400). - packed_per_model = ( - len(build_flat_matrix(model_specs[0], categories, tasks_by_cat, code_impl)) - if model_specs - else 0 + first_matrix = build_flat_matrix( + model_specs[0], categories, tasks_by_cat, code_impl ) + missing_matrix_categories = [ + category + for category in categories + if not any(entry["category"] == category for entry in first_matrix) + ] + if missing_matrix_categories: + raise SystemExit( + "No matrix entries resolved for requested categor(y/ies): " + f"{missing_matrix_categories}" + ) + if not first_matrix: + raise SystemExit("Unified eval matrix is empty.") + packed_per_model = len(first_matrix) total_job_guard(n_models, packed_per_model) # n_shards for the pool = number of single-task shards (pre-pack); derive pool. n_shards = est_tasks - max_parallel, model_parallel = derive_pool(concurrency, rollouts, n_shards, n_models) + max_parallel, model_parallel = derive_pool( + concurrency, rollouts, n_shards, n_models + ) outputs: dict[str, object] = { # The expected grid, so the combiner can flag missing/incomplete leaves diff --git a/.github/scripts/validate_harbor_limits.py b/.github/scripts/validate_harbor_limits.py index b5dc605d535..656de615629 100644 --- a/.github/scripts/validate_harbor_limits.py +++ b/.github/scripts/validate_harbor_limits.py @@ -11,11 +11,11 @@ be set as high as the task count (one task per shard) for dynamic dispatch. Instead, the derived `shard_parallel` (the pool the shards drain through) is what's bounded, alongside the per-shard concurrent-trial count: `shard_parallel - * min(concurrency, rollouts) <= 40`. + * concurrency <= 40`. This module owns the derivation of `shard_parallel` for the single-model case: -`shard_parallel = min(MAX_TASKS_PER_MODEL // min(concurrency, rollouts), -n_shards)`, mirroring `unified_prep.derive_pool` (pinned together by +`shard_parallel = min(MAX_TASKS_PER_MODEL // concurrency, n_shards)`, mirroring +`unified_prep.derive_pool` (pinned together by `test_validate_harbor_limits.py`'s drift-guard test). `main()` emits it as `shard_parallel=` to `$GITHUB_OUTPUT` for `harbor.yml` to pass straight through to the leaf workflow's `shard_parallel` input. @@ -61,13 +61,12 @@ def derive_shard_parallel(concurrency: int, rollouts: int, n_shards: int) -> int """Derive the shard pool size the run job's shards drain through. Mirrors `unified_prep.derive_pool`'s `max_parallel` for a single model: - `per_shard = min(concurrency, rollouts)` is the peak concurrent trials one - 1-task shard ever runs; the pool saturates the per-model - `MAX_TASKS_PER_MODEL` (40) budget without exceeding `n_shards` itself (no - point pooling more than there are shards to drain). + each shard job can use its full `concurrency` when it contains multiple + tasks, even when `rollouts` is lower. The pool saturates the per-model + `MAX_TASKS_PER_MODEL` (40) budget without exceeding `n_shards` itself. """ - per_shard = max(1, min(concurrency, rollouts)) - return max(1, min(MAX_TASKS_PER_MODEL // per_shard, n_shards)) + del rollouts + return max(1, min(MAX_TASKS_PER_MODEL // max(1, concurrency), n_shards)) def validate_limits( @@ -83,25 +82,23 @@ def validate_limits( "(all/set0/frontier/...) and comma-separated overrides are not accepted." ) if n_shards > shard_matrix.MAX_SHARDS: - errors.append(f"n_shards={n_shards} exceeds the cap of {shard_matrix.MAX_SHARDS}") + errors.append( + f"n_shards={n_shards} exceeds the cap of {shard_matrix.MAX_SHARDS}" + ) if concurrency > MAX_CONCURRENCY: errors.append(f"concurrency={concurrency} exceeds the cap of {MAX_CONCURRENCY}") # Defensive, not user-facing: derive_shard_parallel's floor division makes - # this true by construction (never trips). Uses per_shard — the peak - # concurrent trials one 1-task shard actually runs, min(concurrency, - # rollouts) — rather than raw concurrency, since a shard with fewer - # rollouts than its concurrency setting can't use the extra slots (same - # per_shard substitution unified_prep.derive_pool's docstring describes - # loosely as "concurrency"). An explicit raise (never a bare `assert`, - # which `python -O` strips) so a formula regression fails loudly instead - # of silently over-provisioning sandboxes. + # this true by construction (never trips). A shard may contain multiple + # tasks, so its peak is the full concurrency even when each individual task + # has fewer rollouts. An explicit raise (never a bare `assert`, which + # `python -O` strips) makes a formula regression fail loudly instead of + # silently over-provisioning sandboxes. shard_parallel = derive_shard_parallel(concurrency, rollouts, n_shards) - per_shard = max(1, min(concurrency, rollouts)) - if shard_parallel * per_shard > MAX_TASKS_PER_MODEL: + if shard_parallel * concurrency > MAX_TASKS_PER_MODEL: msg = ( f"internal error: derived shard_parallel={shard_parallel} * " - f"per_shard={per_shard} exceeds {MAX_TASKS_PER_MODEL}" + f"concurrency={concurrency} exceeds {MAX_TASKS_PER_MODEL}" ) raise AssertionError(msg) return errors diff --git a/.github/workflows/harbor.yml b/.github/workflows/harbor.yml index 186087e6702..ff2b71c074b 100644 --- a/.github/workflows/harbor.yml +++ b/.github/workflows/harbor.yml @@ -184,7 +184,7 @@ on: default: false type: boolean n_shards: - description: "Split the dataset's tasks across N shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). May be set as high as the task count (one task per shard) for dynamic dispatch — shards drain through a derived pool (shard_parallel), not all at once. Capped at 200 (shard_matrix.MAX_SHARDS); the pool is bounded so shard_parallel * min(concurrency, rollouts_per_task) <= 40 concurrent sandboxes." + description: "Split the dataset's tasks across N shard jobs per model (each on its own runner at the per-job concurrency). Composes with include_tasks/n_tasks: those select the task set first, then it's partitioned across shards (total tasks run is unchanged). May be set as high as the task count (one task per shard) for dynamic dispatch — shards drain through a derived pool (shard_parallel), not all at once. Capped at 200 (shard_matrix.MAX_SHARDS); the pool is bounded so shard_parallel * concurrency <= 40 concurrent sandboxes." required: false default: "10" type: string @@ -281,7 +281,7 @@ jobs: # concurrency <= 4). n_shards may be set high for dynamic dispatch (one # task per shard); shards drain through a derived shard_parallel pool # instead of all running at once, bounded so shard_parallel * - # min(concurrency, rollouts) <= 40 concurrent sandboxes. Inputs are read + # concurrency <= 40 concurrent sandboxes. Inputs are read # via env (no shell interpolation) and int-parsed in the script. # See validate_harbor_limits.py (unit-tested in test_validate_harbor_limits.py). id: limits