Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(tier3): enforce judge overrides at job scope

Christopher Kevinaeb80cbfef49
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 516251ba..f3951892 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -91,10 +91,15 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
- Tier 3 now forwards host-configured `LLM_JUDGE_MODEL` and
- `SKILL_EVAL_JUDGE_MODEL` overrides to generated and native Harbor verifiers
- while keeping them out of agent environments. Skill-authored `runtime_env`
- and native task environments cannot set or alias either operator-controlled
- judge override.
+ `SKILL_EVAL_JUDGE_MODEL` overrides through Harbor's verifier-only job layer
+ for standard grading. They are not injected into the evaluated agent's
+ initial environment; skill-authored `runtime_env` and native task
+ `[environment.env]` tables cannot set or alias either operator-controlled
+ override.
+ Native verifier declarations remain compatible, while the job-level value
+ takes precedence during standard grading. Tier 3 results now record the
+ resolved judge provider, model, source, and whether a dedicated job-wide
+ override was applied, separately from agent models.
- Quality scoring now uses boundary-aware and context-aware matching for XML tags,
reserved names, MCP guidance, README references, time references, exclusivity
language, instruction action verbs, and nested Markdown links, avoiding
diff --git a/docs/environment-variables.mdx b/docs/environment-variables.mdx
index 6e9aae0f..335645ca 100644
--- a/docs/environment-variables.mdx
+++ b/docs/environment-variables.mdx
@@ -101,7 +101,7 @@ execution environments are covered in
| `SKILLEVALUATOR_LOCAL_INHERIT_AGENT_KEYS` | `false` | When true, local-mode trials inherit the host's agent credential variables into their ambient environment. Off by default so a hostile skill command cannot read credentials — agents and verifiers receive credentials per-exec instead. |
| `SKILLEVALUATOR_RUNTIME_DIR` | `~/.local/share/skillevaluator/runtimes` | Where local mode looks for managed agent CLIs. Must be a dedicated subdirectory — not the home directory or one of its parents. |
| `SKILL_EVAL_HARBOR_PREBUILD_TASK_ENVS` | unset | Set to exactly `1` to opt in to pre-building Harbor task environment images before trials start (other truthy spellings are not honored). Opt-in because concurrent trial cleanup can remove a shared prebuilt image that sibling trials still need. |
-| `SKILL_EVAL_JUDGE_MODEL` | falls back to `SKILL_EVAL_LLM_MODEL` | Operator-controlled model override for the Tier 3 dimension judge in standard grading. `LLM_JUDGE_MODEL` is honored as a higher-precedence spelling; when neither is set, the judge uses `SKILL_EVAL_LLM_MODEL`, then the built-in judge default. Both spellings change only the model used with the configured `SKILL_EVAL_LLM_PROVIDER`; they do not select a separate judge provider, so the model must be supported by that provider. The override is staged only for the verifier, never the evaluated agent; attempts to set or reference it from skill-authored `runtime_env` or native task environments are rejected. |
+| `SKILL_EVAL_JUDGE_MODEL` | falls back to `SKILL_EVAL_LLM_MODEL` | Operator-controlled model override for the Tier 3 dimension judge in standard grading. `LLM_JUDGE_MODEL` is honored as a higher-precedence spelling; when neither is set, the judge uses `SKILL_EVAL_LLM_MODEL`, then the built-in judge default. Both spellings change only the model used with the configured `SKILL_EVAL_LLM_PROVIDER`; they do not select a separate judge provider, so the model must be supported by that provider. Standard grading passes a dedicated override through Harbor's verifier-only job layer, which takes precedence over task and step verifier declarations. It is not injected into the evaluated agent's initial environment; attempts to set or reference it from skill-authored `runtime_env` or native `[environment.env]` tables are rejected. Native custom-only graders keep ownership of their verifier configuration. Shared agent/verifier containers are a process boundary, not a confidentiality boundary; use a separate verifier environment when the model name itself must be hidden from untrusted agent processes. `run_config.json` records the resolved judge provider, model, source, and `override_applied` separately from agent models. When `override_applied` is false for a native Harbor task, an authored task or step verifier declaration may supersede that recorded fallback. |
| `SKILLEVALUATOR_HARBOR_DIAGNOSTIC_ARTIFACT_MAX_BYTES` | `5242880` (5 MiB) | Size cap per diagnostic artifact copied from a Harbor trial into the results directory; oversized artifacts are skipped and recorded in the artifact manifest. |
## In-container grader contract
diff --git a/src/skillevaluator/tier3/harbor/adapter.py b/src/skillevaluator/tier3/harbor/adapter.py
index dc4d0a2b..1e479915 100644
--- a/src/skillevaluator/tier3/harbor/adapter.py
+++ b/src/skillevaluator/tier3/harbor/adapter.py
@@ -202,43 +202,40 @@ _COMPOSE_ALLOWED_BUILD_KEYS = frozenset(
_COMPOSE_ALLOWED_NETWORK_KEYS = frozenset({"attachable", "enable_ipv4", "enable_ipv6", "internal", "labels"})
_COMPOSE_ALLOWED_VOLUME_KEYS = frozenset({"labels"})
_VERIFIER_JUDGE_MODEL_ENV_VARS = frozenset({"LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"})
-_VERIFIER_PROVIDER_ENV_VARS = (
- frozenset(
- {
- "SKILL_EVAL_LLM_PROVIDER",
- "SKILL_EVAL_LLM_MODEL",
- "SKILL_EVAL_LLM_API_KEY",
- "SKILL_EVAL_LLM_BASE_URL",
- "OPENAI_API_KEY",
- "OPENAI_BASE_URL",
- "ANTHROPIC_API_KEY",
- "ANTHROPIC_BASE_URL",
- "NVIDIA_API_KEY",
- "AWS_REGION",
- "AWS_ACCESS_KEY_ID",
- "AWS_BEARER_TOKEN_BEDROCK",
- "AWS_CONFIG_FILE",
- "AWS_CONTAINER_AUTHORIZATION_TOKEN",
- "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",
- "AWS_CONTAINER_CREDENTIALS_FULL_URI",
- "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",
- "AWS_DEFAULT_REGION",
- "AWS_PROFILE",
- "AWS_ROLE_ARN",
- "AWS_ROLE_SESSION_NAME",
- "AWS_SDK_LOAD_CONFIG",
- "AWS_SECRET_ACCESS_KEY",
- "AWS_SESSION_TOKEN",
- "AWS_SHARED_CREDENTIALS_FILE",
- "AWS_WEB_IDENTITY_TOKEN_FILE",
- }
- )
- | _VERIFIER_JUDGE_MODEL_ENV_VARS
+_VERIFIER_PROVIDER_ENV_VARS = frozenset(
+ {
+ "SKILL_EVAL_LLM_PROVIDER",
+ "SKILL_EVAL_LLM_MODEL",
+ "SKILL_EVAL_LLM_API_KEY",
+ "SKILL_EVAL_LLM_BASE_URL",
+ "OPENAI_API_KEY",
+ "OPENAI_BASE_URL",
+ "ANTHROPIC_API_KEY",
+ "ANTHROPIC_BASE_URL",
+ "NVIDIA_API_KEY",
+ "AWS_REGION",
+ "AWS_ACCESS_KEY_ID",
+ "AWS_BEARER_TOKEN_BEDROCK",
+ "AWS_CONFIG_FILE",
+ "AWS_CONTAINER_AUTHORIZATION_TOKEN",
+ "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",
+ "AWS_CONTAINER_CREDENTIALS_FULL_URI",
+ "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",
+ "AWS_DEFAULT_REGION",
+ "AWS_PROFILE",
+ "AWS_ROLE_ARN",
+ "AWS_ROLE_SESSION_NAME",
+ "AWS_SDK_LOAD_CONFIG",
+ "AWS_SECRET_ACCESS_KEY",
+ "AWS_SESSION_TOKEN",
+ "AWS_SHARED_CREDENTIALS_FILE",
+ "AWS_WEB_IDENTITY_TOKEN_FILE",
+ }
)
def _verifier_env_vars(runtime_env: dict[str, str] | None = None) -> tuple[str, ...]:
- """Return evaluator-controlled variables explicitly staged for the verifier."""
+ """Return public provider variables explicitly staged for the verifier."""
return tuple(sorted(set(runtime_env or {}).intersection(_VERIFIER_PROVIDER_ENV_VARS)))
@@ -4246,80 +4243,15 @@ def _judge_model_env_controls(environment: dict[str, Any]) -> set[str]:
return authored_keys | authored_references
-def _native_env_table(container: dict[str, Any], *, path: str, task_toml: Path) -> dict[str, Any]:
- environment = container.get("env", {})
- if not isinstance(environment, dict):
- raise ValueError(f"Native Harbor task [{path}] must be a table: {task_toml}")
- return environment
-
-
-def _native_verifier_env_tables(
- verifier: dict[str, Any],
- *,
- path: str,
- task_toml: Path,
-) -> list[tuple[str, dict[str, Any]]]:
- """Return every process or persistent environment owned by a verifier."""
- environments = [(f"{path}.env", _native_env_table(verifier, path=f"{path}.env", task_toml=task_toml))]
- persistent = verifier.get("environment")
- if persistent is None:
- return environments
- if not isinstance(persistent, dict):
- raise ValueError(f"Native Harbor task [{path}.environment] must be a table: {task_toml}")
- environments.append(
- (
- f"{path}.environment.env",
- _native_env_table(persistent, path=f"{path}.environment.env", task_toml=task_toml),
- )
- )
- return environments
-
-
-def _validate_native_judge_model_controls(
- task_toml: Path,
- *,
- data: dict[str, Any],
- environment_env: dict[str, Any],
-) -> None:
- agent_controls = sorted(_judge_model_env_controls(environment_env))
- if agent_controls:
+def _validate_native_agent_judge_model_controls(task_toml: Path, environment_env: dict[str, Any]) -> None:
+ """Keep host judge controls out of the native task's agent environment."""
+ controls = sorted(_judge_model_env_controls(environment_env))
+ if controls:
raise ValueError(
f"Native Harbor task [environment.env] cannot name or reference evaluator-controlled judge model "
- f"variable(s): {', '.join(agent_controls)}: {task_toml}"
+ f"variable(s): {', '.join(controls)}: {task_toml}"
)
- verifier = data.get("verifier", {})
- if not isinstance(verifier, dict):
- raise ValueError(f"Native Harbor task [verifier] must be a table: {task_toml}")
- verifier_tables = _native_verifier_env_tables(verifier, path="verifier", task_toml=task_toml)
-
- steps = data.get("steps", [])
- if steps is None:
- steps = []
- if not isinstance(steps, list):
- raise ValueError(f"Native Harbor task [[steps]] must be an array of tables: {task_toml}")
- for index, step in enumerate(steps):
- if not isinstance(step, dict):
- raise ValueError(f"Native Harbor task [[steps]] entry {index} must be a table: {task_toml}")
- step_verifier = step.get("verifier", {})
- if not isinstance(step_verifier, dict):
- raise ValueError(f"Native Harbor task [steps.verifier] entry {index} must be a table: {task_toml}")
- verifier_tables.extend(
- _native_verifier_env_tables(
- step_verifier,
- path=f"steps[{index}].verifier",
- task_toml=task_toml,
- )
- )
-
- for path, environment in verifier_tables:
- controls = sorted(_judge_model_env_controls(environment))
- if controls:
- raise ValueError(
- f"Native Harbor task [{path}] cannot name or reference evaluator-controlled judge model "
- f"variable(s): {', '.join(controls)}: {task_toml}"
- )
-
def _native_task_workdir(task_dir: Path, *, allow_docker_image: bool = False) -> str | None:
"""Read and validate the workdir Harbor will use for a native task."""
@@ -4335,14 +4267,7 @@ def _native_task_workdir(task_dir: Path, *, allow_docker_image: bool = False) ->
environment_env = environment.get("env", {})
if not isinstance(environment_env, dict):
raise ValueError(f"Native Harbor task [environment.env] must be a table: {task_dir / 'task.toml'}")
- verifier = data.get("verifier", {}) if isinstance(data, dict) else {}
- if not isinstance(verifier, dict):
- raise ValueError(f"Native Harbor task [verifier] must be a table: {task_dir / 'task.toml'}")
- _validate_native_judge_model_controls(
- task_dir / "task.toml",
- data=data,
- environment_env=environment_env,
- )
+ _validate_native_agent_judge_model_controls(task_dir / "task.toml", environment_env)
_validate_runtime_discovery_env(environment_env)
_validate_runtime_loader_env(environment_env)
skills_dir = environment.get("skills_dir")
@@ -4383,71 +4308,40 @@ def _ensure_native_skills_dir(task_dir: Path) -> None:
task_toml.write_text("\n".join(lines) + "\n", encoding="utf-8")
-def _toml_table_header_indices(lines: list[str], *segments: str) -> tuple[int, ...]:
- """Locate raw candidates for a standard bare or quoted TOML table header."""
- segment_patterns = [
- rf"(?:{re.escape(segment)}|\"{re.escape(segment)}\"|'{re.escape(segment)}')" for segment in segments
- ]
- pattern = re.compile(r"^\s*\[\s*" + r"\s*\.\s*".join(segment_patterns) + r"\s*\]\s*(?:#.*)?$")
- return tuple(index for index, line in enumerate(lines) if pattern.fullmatch(line))
-
-
-def _has_expected_verifier_env(content: str, expected: dict[str, str]) -> bool:
- """Return whether parsed TOML contains the exact managed verifier values."""
- try:
- parsed = tomllib.loads(content)
- except tomllib.TOMLDecodeError:
- return False
- verifier = parsed.get("verifier", {}) if isinstance(parsed, dict) else {}
- environment = verifier.get("env", {}) if isinstance(verifier, dict) else {}
- return isinstance(environment, dict) and all(environment.get(name) == value for name, value in expected.items())
-
-
def _ensure_skill_evaluator_verifier_env(task_dir: Path, *, verifier_env: dict[str, str] | None) -> None:
- """Ensure staged native tasks forward configured evaluator variables."""
+ """Ensure staged native tasks forward configured public provider variables."""
task_toml = task_dir / "task.toml"
content = task_toml.read_text(encoding="utf-8")
- managed_names = _verifier_env_vars(verifier_env)
- if not managed_names:
+ env_lines = [f'{name} = "${{{name}}}"' for name in _verifier_env_vars(verifier_env)]
+ if all(line in content for line in env_lines):
return
- parsed = tomllib.loads(content)
- parsed_verifier = parsed.get("verifier", {}) if isinstance(parsed, dict) else {}
- if not isinstance(parsed_verifier, dict):
- raise ValueError(f"Native Harbor task [verifier] must be a table: {task_toml}")
- expected = {name: f"${{{name}}}" for name in managed_names}
lines = content.splitlines()
- if "env" in parsed_verifier:
- parsed_verifier_env = parsed_verifier["env"]
- if not isinstance(parsed_verifier_env, dict):
- raise ValueError(f"Native Harbor task [verifier.env] must be a table: {task_toml}")
- env_lines = [
- f'{name} = "{value}"' for name, value in expected.items() if parsed_verifier_env.get(name) != value
- ]
- if not env_lines:
- return
- updated_content = ""
- for verifier_env_index in _toml_table_header_indices(lines, "verifier", "env"):
- candidate_lines = lines.copy()
- candidate_lines[verifier_env_index + 1 : verifier_env_index + 1] = env_lines
- candidate = "\n".join(candidate_lines) + "\n"
- if _has_expected_verifier_env(candidate, expected):
- updated_content = candidate
+ if "[verifier.env]" in lines:
+ idx = lines.index("[verifier.env]") + 1
+ existing = set(lines)
+ for line in reversed(env_lines):
+ if line not in existing:
+ lines.insert(idx, line)
+ task_toml.write_text("\n".join(lines) + "\n", encoding="utf-8")
+ return
+
+ env_block = ["[verifier.env]", *env_lines]
+ if "[verifier]" in lines:
+ start = lines.index("[verifier]") + 1
+ insert_at = len(lines)
+ for idx in range(start, len(lines)):
+ line = lines[idx].strip()
+ if line.startswith("[") and line.endswith("]"):
+ insert_at = idx
break
- if not updated_content:
- raise ValueError(f"Native Harbor task [verifier.env] must use a standard table header: {task_toml}")
- else:
- env_lines = [f'{name} = "{value}"' for name, value in expected.items()]
- env_block = ["[verifier.env]", *env_lines]
- if "verifier" in parsed:
- candidate_lines = [*lines, "", *env_block]
- else:
- candidate_lines = [*lines, "", "[verifier]", "timeout_sec = 180.0", "", *env_block]
- updated_content = "\n".join(candidate_lines) + "\n"
+ lines[insert_at:insert_at] = ["", *env_block]
+ task_toml.write_text("\n".join(lines) + "\n", encoding="utf-8")
+ return
- if not _has_expected_verifier_env(updated_content, expected):
- raise ValueError(f"Cannot inject evaluator-controlled [verifier.env] into native task: {task_toml}")
- task_toml.write_text(updated_content, encoding="utf-8")
+ insert_at = lines.index("[environment]") if "[environment]" in lines else len(lines)
+ lines[insert_at:insert_at] = ["[verifier]", "timeout_sec = 180.0", "", *env_block, ""]
+ task_toml.write_text("\n".join(lines) + "\n", encoding="utf-8")
def _insert_table_block(lines: list[str], anchor: str, block: list[str]) -> None:
diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.py
index 26c38b8a..691f71ee 100644
--- a/src/skillevaluator/tier3/harbor/runner.py
+++ b/src/skillevaluator/tier3/harbor/runner.py
@@ -339,6 +339,7 @@ def build_harbor_run_command(
override_memory_mb: int | None = None,
override_storage_mb: int | None = None,
agent_import_path: str | None = None,
+ verifier_env: Mapping[str, str] | None = None,
) -> list[str]:
"""Build a Harbor invocation for a built-in environment type or local mode."""
if env_mode not in HARBOR_ENV_MODES:
@@ -418,6 +419,8 @@ def build_harbor_run_command(
command.extend(["--override-memory-mb", str(override_memory_mb)])
if override_storage_mb is not None:
command.extend(["--override-storage-mb", str(override_storage_mb)])
+ for name, value in sorted((verifier_env or {}).items()):
+ command.extend(["--verifier-env", f"{name}={value}"])
if _harbor_supports_yes():
command.append("--yes")
return command
@@ -739,13 +742,6 @@ def _resolve_runtime_env(templates: dict[str, str] | None) -> tuple[dict[str, st
f"harbor.runtime_env.{name} references operator-owned credential(s): " + ", ".join(owned_references)
)
continue
- if percent_references:
- errors.append(
- f"harbor.runtime_env.{name} uses unsupported %VAR% reference syntax for: "
- + ", ".join(sorted(percent_references))
- + "; use ${VAR}"
- )
- continue
value = os.path.expandvars(template_value)
if "$" in value:
errors.append(f"harbor.runtime_env.{name} references an unset environment variable")
@@ -807,6 +803,48 @@ def _harbor_subprocess_environment(
return environment
+def _judge_model_config(
+ provider: ProviderConfig,
+ provider_env: Mapping[str, str],
+ grading_mode: str,
+) -> dict[str, str | bool]:
+ """Describe the configured standard-grading judge before any provider fallback."""
+ if grading_mode == "custom_only":
+ return {"enabled": False}
+ for name in ("LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"):
+ if model := provider_env.get(name):
+ return {
+ "enabled": True,
+ "provider": provider.provider,
+ "model": model,
+ "source": name,
+ "override_applied": True,
+ }
+ return {
+ "enabled": True,
+ "provider": provider.provider,
+ "model": provider.model,
+ "source": (
+ "SKILL_EVAL_LLM_MODEL" if os.environ.get("SKILL_EVAL_LLM_MODEL", "").strip() else "provider default"
+ ),
+ "override_applied": False,
+ }
+
+
+def _job_judge_verifier_env(provider_env: Mapping[str, str], grading_mode: str) -> dict[str, str]:
+ """Return host-resolved judge overrides for Harbor's verifier-only job layer."""
+ if grading_mode == "custom_only":
+ return {}
+ if provider_env.get("LLM_JUDGE_MODEL"):
+ return {"LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}"}
+ if provider_env.get("SKILL_EVAL_JUDGE_MODEL"):
+ # The bundled verifier reads LLM_JUDGE_MODEL first. Place either host
+ # override at that highest-precedence key so a task-authored legacy
+ # value cannot win after Harbor merges task, step, and job env.
+ return {"LLM_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"}
+ return {}
+
+
def _agent_credentials(
*,
provider: ProviderConfig,
@@ -1131,6 +1169,7 @@ def _run_harbor(
override_memory_mb: int | None,
override_storage_mb: int | None,
agent_import_path: str | None = None,
+ verifier_env: Mapping[str, str] | None = None,
expected_trials: int | None = None,
expected_total_trials: int | None = None,
include_task_names: list[str] | None = None,
@@ -1150,6 +1189,7 @@ def _run_harbor(
override_memory_mb=override_memory_mb,
override_storage_mb=override_storage_mb,
agent_import_path=agent_import_path,
+ verifier_env=verifier_env,
)
try:
with _nvidia_build_key_handoff(run_env, env_mode=env_mode) as subprocess_env:
@@ -1406,6 +1446,7 @@ def _run_stop_on_pass_variant(
override_memory_mb: int | None,
override_storage_mb: int | None,
agent_import_path: str | None = None,
+ verifier_env: Mapping[str, str] | None = None,
) -> list[str]:
"""Run each case one attempt at a time, stopping its attempts on first pass."""
errors: list[str] = []
@@ -1428,6 +1469,7 @@ def _run_stop_on_pass_variant(
override_memory_mb=override_memory_mb,
override_storage_mb=override_storage_mb,
agent_import_path=agent_import_path,
+ verifier_env=verifier_env,
expected_trials=1,
include_task_names=[task_name],
)
@@ -1463,6 +1505,7 @@ def _run_agent_pair(
stop_on_pass: bool = False,
pass_threshold: float = 0.50,
task_names: list[str] | None = None,
+ verifier_env: Mapping[str, str] | None = None,
) -> list[str]:
jobs = [("with", with_skill)]
if baseline is not None:
@@ -1490,6 +1533,7 @@ def _run_agent_pair(
override_memory_mb=override_memory_mb,
override_storage_mb=override_storage_mb,
agent_import_path=agent_import_path,
+ verifier_env=verifier_env,
)
)
return sequential_errors
@@ -1520,6 +1564,7 @@ def _run_agent_pair(
override_memory_mb=override_memory_mb,
override_storage_mb=override_storage_mb,
agent_import_path=agent_import_path,
+ verifier_env=verifier_env,
expected_trials=expected_trials,
): variant
for (variant, dataset), condition_concurrency in zip(jobs, job_concurrency, strict=True)
@@ -1842,7 +1887,8 @@ def _run_harbor_eval_impl(
)
reporter.emit(ProgressEvent(stage="credential-validation", state="complete", detail="credentials validated"))
verifier_env = {**configured_runtime_env, **provider_env}
- staged_verifier_env = {name: f"${{{name}}}" for name in verifier_env}
+ staged_verifier_env = {name: f"${{{name}}}" for name in verifier_env if name not in _VERIFIER_JUDGE_MODEL_ENV_VARS}
+ job_judge_verifier_env = _job_judge_verifier_env(provider_env, grading_mode)
include_values = [*workspace_config.get("include", []), *(include_skills or [])]
if include_values and workspace_mode != "group":
@@ -2156,6 +2202,7 @@ def _run_harbor_eval_impl(
stop_on_pass=bool(stop_on_pass),
pass_threshold=float(pass_threshold),
task_names=task_names,
+ verifier_env=job_judge_verifier_env,
)
active_agents: set[str] = set()
@@ -2248,6 +2295,7 @@ def _run_harbor_eval_impl(
"jobs_retained": keep_harbor_jobs,
},
"provider": {"name": provider.provider, "model": provider.model},
+ "judge": _judge_model_config(provider, provider_env, grading_mode),
"task_source": task_source,
"grading": {"mode": grading_mode},
"agents": model_resolution,
diff --git a/tests/test_harbor_runner_environment.py b/tests/test_harbor_runner_environment.py
index 017227cd..1cf79c6d 100644
--- a/tests/test_harbor_runner_environment.py
+++ b/tests/test_harbor_runner_environment.py
@@ -213,7 +213,7 @@ def test_skill_config_cannot_control_evaluator_or_judge_routing(name: str) -> No
@pytest.mark.parametrize("name", ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"])
[email protected]("provider_name", ["openai", "anthropic", "bedrock", "nv_build"])
[email protected]("provider_name", ["openai", "openai-compatible", "anthropic", "bedrock", "nv_build"])
@pytest.mark.parametrize(
("configured", "expected"),
[
@@ -237,17 +237,10 @@ def test_provider_environment_forwards_each_host_judge_model_override(
assert environment.get(name) == expected
- ("source_name", "expected_error"),
- [
- ("LLM_JUDGE_MODEL", "operator-owned"),
- ("HOST_AGENT_TOKEN", "unsupported"),
- ],
-)
-def test_runtime_env_rejects_windows_style_variable_references(
[email protected]("source_name", ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"])
+def test_runtime_env_rejects_operator_owned_windows_style_variable_references(
monkeypatch: pytest.MonkeyPatch,
source_name: str,
- expected_error: str,
) -> None:
monkeypatch.setenv(source_name, "host-value")
@@ -255,7 +248,83 @@ def test_runtime_env_rejects_windows_style_variable_references(
assert resolved == {}
assert errors and source_name in errors[0]
- assert expected_error in errors[0]
+ assert "operator-owned" in errors[0]
+
+
+def test_runtime_env_preserves_platform_expansion_for_non_owned_percent_references(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ expanded: list[str] = []
+
+ def expandvars(value: str) -> str:
+ expanded.append(value)
+ return value.replace("%HOST_AGENT_TOKEN%", "host-value")
+
+ monkeypatch.setattr(runner.os.path, "expandvars", expandvars)
+
+ resolved, errors = runner._resolve_runtime_env({"SAFE_ALIAS": "%HOST_AGENT_TOKEN%"})
+
+ assert errors == []
+ assert resolved == {"SAFE_ALIAS": "host-value"}
+ assert expanded == ["%HOST_AGENT_TOKEN%"]
+
+
+def test_custom_only_does_not_force_the_standard_judge_model_into_custom_verifiers() -> None:
+ provider_env = {
+ "LLM_JUDGE_MODEL": "legacy-judge-model",
+ "SKILL_EVAL_JUDGE_MODEL": "judge-model",
+ }
+
+ assert runner._job_judge_verifier_env(provider_env, "custom_only") == {}
+ assert runner._judge_model_config(_provider("nv_build"), provider_env, "custom_only") == {
+ "enabled": False,
+ }
+
+
+ ("provider_env", "expected"),
+ [
+ (
+ {"SKILL_EVAL_JUDGE_MODEL": "operator-model"},
+ {"LLM_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"},
+ ),
+ (
+ {"LLM_JUDGE_MODEL": "legacy-model", "SKILL_EVAL_JUDGE_MODEL": "operator-model"},
+ {"LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}"},
+ ),
+ ],
+)
+def test_standard_judge_override_occupies_the_highest_precedence_verifier_key(
+ provider_env: dict[str, str],
+ expected: dict[str, str],
+) -> None:
+ assert runner._job_judge_verifier_env(provider_env, "default") == expected
+
+
+ ("configured_model", "expected_source"),
+ [(None, "provider default"), ("operator-model", "SKILL_EVAL_LLM_MODEL")],
+)
+def test_judge_model_config_distinguishes_provider_default_from_explicit_model(
+ monkeypatch: pytest.MonkeyPatch,
+ configured_model: str | None,
+ expected_source: str,
+) -> None:
+ if configured_model is None:
+ monkeypatch.delenv("SKILL_EVAL_LLM_MODEL", raising=False)
+ else:
+ monkeypatch.setenv("SKILL_EVAL_LLM_MODEL", configured_model)
+ provider = _provider("openai")
+
+ config = runner._judge_model_config(provider, runner._provider_environment(provider), "default")
+
+ assert config == {
+ "enabled": True,
+ "provider": "openai",
+ "model": "test-model",
+ "source": expected_source,
+ "override_applied": False,
+ }
def test_mixed_agents_receive_disjoint_credentials(monkeypatch: pytest.MonkeyPatch) -> None:
@@ -460,7 +529,7 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
(skill / "evals" / "evals.json").write_text("[]\n", encoding="utf-8")
provider = _provider("nv_build")
emitted: list[tuple[str, bool, dict[str, str], dict[str, str]]] = []
- launched: dict[str, tuple[str, str, dict[str, str]]] = {}
+ launched: dict[str, tuple[str, str, dict[str, str], dict[str, str]]] = {}
monkeypatch.setenv("LLM_JUDGE_MODEL", "legacy-judge-model")
monkeypatch.setenv("SKILL_EVAL_JUDGE_MODEL", "judge-model")
@@ -492,6 +561,7 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
str(kwargs["with_skill"].relative_to(tmp_path / "results")),
str(kwargs["baseline"].relative_to(tmp_path / "results")),
dict(kwargs["run_env"]),
+ dict(kwargs["verifier_env"]),
)
return []
@@ -535,8 +605,8 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
for _path, _with_skill, runtime_env, verifier_env in emitted:
assert "LLM_JUDGE_MODEL" not in runtime_env
assert "SKILL_EVAL_JUDGE_MODEL" not in runtime_env
- assert verifier_env["LLM_JUDGE_MODEL"] == "${LLM_JUDGE_MODEL}"
- assert verifier_env["SKILL_EVAL_JUDGE_MODEL"] == "${SKILL_EVAL_JUDGE_MODEL}"
+ assert "LLM_JUDGE_MODEL" not in verifier_env
+ assert "SKILL_EVAL_JUDGE_MODEL" not in verifier_env
assert launched["opencode"][0].endswith("_harbor-tasks/opencode/with")
assert launched["claude-code"][1].endswith("_harbor-tasks/claude-code/without")
assert launched["opencode"][2]["LLM_JUDGE_MODEL"] == "legacy-judge-model"
@@ -544,6 +614,15 @@ def test_run_harbor_eval_stages_per_agent_credential_trees(
assert "ANTHROPIC_API_KEY" not in launched["opencode"][2]
assert "OPENAI_API_KEY" not in launched["opencode"][2]
assert launched["claude-code"][2]["NVIDIA_API_KEY"] == "provider-key"
+ assert launched["opencode"][3] == {"LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}"}
+ assert launched["claude-code"][3] == launched["opencode"][3]
+ assert result["run_config"]["judge"] == {
+ "enabled": True,
+ "provider": "nv_build",
+ "model": "legacy-judge-model",
+ "source": "LLM_JUDGE_MODEL",
+ "override_applied": True,
+ }
def test_run_harbor_eval_rejects_provenance_key_inside_skill_before_creation(
diff --git a/tests/test_harbor_runner_status.py b/tests/test_harbor_runner_status.py
index a1c9ff51..06d3de02 100644
--- a/tests/test_harbor_runner_status.py
+++ b/tests/test_harbor_runner_status.py
@@ -158,12 +158,16 @@ def test_stop_on_pass_preserves_nvidia_build_agent_import_path(
agent_import_path=import_path,
stop_on_pass=True,
task_names=["case-001"],
+ verifier_env={"SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"},
)
assert errors == []
assert len(launches) == 1
assert launches[0]["agent_import_path"] == import_path
assert launches[0]["include_task_names"] == ["case-001"]
+ assert launches[0]["verifier_env"] == {
+ "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
+ }
_UNSAFE_LINK = r"symlink|reparse"
diff --git a/tests/test_harbor_runtime_skill_isolation.py b/tests/test_harbor_runtime_skill_isolation.py
index 668c9ffd..6140d229 100644
--- a/tests/test_harbor_runtime_skill_isolation.py
+++ b/tests/test_harbor_runtime_skill_isolation.py
@@ -221,16 +221,18 @@ def test_native_tasks_project_runtime_skills_without_root_evals(tmp_path: Path)
assert (task / "tests" / "entry.json").is_file()
assert (task / "tests" / "grader.py").is_file()
task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
- assert task_config["verifier"]["env"] == {
- "LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
- }
+ assert "verifier" not in task_config
assert "LLM_JUDGE_MODEL" not in task_config["environment"].get("env", {})
assert "SKILL_EVAL_JUDGE_MODEL" not in task_config["environment"].get("env", {})
@pytest.mark.parametrize("name", ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"])
-def test_native_tasks_reject_authored_judge_model_in_verifier_env(tmp_path: Path, name: str) -> None:
[email protected]("grading_mode", ["default", "custom_only"])
+def test_native_tasks_preserve_authored_judge_model_in_verifier_env(
+ tmp_path: Path,
+ name: str,
+ grading_mode: str,
+) -> None:
_, target, _, _ = _write_projection_fixture(tmp_path)
_write_minimal_native_task(target)
task_toml = target / "evals" / "harbor" / "case-001" / "task.toml"
@@ -240,12 +242,21 @@ def test_native_tasks_reject_authored_judge_model_in_verifier_env(tmp_path: Path
)
task_toml.write_text(content, encoding="utf-8")
- with pytest.raises(ValueError, match=rf"verifier\.env.*{name}|{name}.*verifier\.env"):
- stage_native_harbor_tasks(
- target,
- tmp_path / f"native-verifier-{name.lower()}",
- verifier_env={name: f"${{{name}}}"},
- )
+ task = stage_native_harbor_tasks(
+ target,
+ tmp_path / f"native-verifier-{grading_mode}-{name.lower()}",
+ grading_mode=grading_mode,
+ verifier_env={
+ "SKILL_EVAL_LLM_PROVIDER": "${SKILL_EVAL_LLM_PROVIDER}",
+ name: f"${{{name}}}",
+ },
+ )[0]
+
+ task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
+ expected = {name: "skill-model"}
+ if grading_mode == "default":
+ expected["SKILL_EVAL_LLM_PROVIDER"] = "${SKILL_EVAL_LLM_PROVIDER}"
+ assert task_config["verifier"]["env"] == expected
@pytest.mark.parametrize(
@@ -273,57 +284,6 @@ def test_native_tasks_reject_judge_model_controls_in_agent_environment(tmp_path:
stage_native_harbor_tasks(target, tmp_path / "native-agent-judge-control")
-def test_native_task_comments_cannot_suppress_judge_model_injection(tmp_path: Path) -> None:
- _, target, _, _ = _write_projection_fixture(tmp_path)
- _write_minimal_native_task(target)
- task_toml = target / "evals" / "harbor" / "case-001" / "task.toml"
- content = task_toml.read_text(encoding="utf-8").replace(
- "[environment]",
- '# LLM_JUDGE_MODEL = "${LLM_JUDGE_MODEL}"\n'
- '# SKILL_EVAL_JUDGE_MODEL = "${SKILL_EVAL_JUDGE_MODEL}"\n\n'
- "[environment]",
- )
- task_toml.write_text(content, encoding="utf-8")
-
- task = stage_native_harbor_tasks(
- target,
- tmp_path / "native-comment-placeholder",
- verifier_env={
- "LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
- },
- )[0]
-
- task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
- assert task_config["verifier"]["env"] == {
- "LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
- }
-
-
-def test_native_task_preserves_noncanonical_verifier_env_table_when_injecting(tmp_path: Path) -> None:
- _, target, _, _ = _write_projection_fixture(tmp_path)
- _write_minimal_native_task(target)
- task_toml = target / "evals" / "harbor" / "case-001" / "task.toml"
- content = task_toml.read_text(encoding="utf-8").replace(
- "[environment]",
- '[verifier]\ntimeout_sec = 180.0\n\n[ verifier . env ]\nCUSTOM = "preserved"\n\n[environment]',
- )
- task_toml.write_text(content, encoding="utf-8")
-
- task = stage_native_harbor_tasks(
- target,
- tmp_path / "native-noncanonical-verifier-table",
- verifier_env={"SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"},
- )[0]
-
- task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
- assert task_config["verifier"]["env"] == {
- "CUSTOM": "preserved",
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
- }
-
-
def test_native_task_reuses_existing_exact_provider_placeholder_when_injecting(tmp_path: Path) -> None:
_, target, _, _ = _write_projection_fixture(tmp_path)
_write_minimal_native_task(target)
@@ -351,48 +311,31 @@ def test_native_task_reuses_existing_exact_provider_placeholder_when_injecting(t
}
[email protected]("decoy_header", ["[verifier]", "[verifier.env]"])
-def test_native_task_ignores_verifier_header_inside_multiline_string(
- tmp_path: Path,
- decoy_header: str,
-) -> None:
- _, target, _, _ = _write_projection_fixture(tmp_path)
- _write_minimal_native_task(target)
- task_toml = target / "evals" / "harbor" / "case-001" / "task.toml"
- content = task_toml.read_text(encoding="utf-8").replace(
- '[metadata]\nentry_id = "case-001"',
- f'[metadata]\nentry_id = "case-001"\ndescription = """\n{decoy_header}\ndecoy\n"""',
- )
- task_toml.write_text(content, encoding="utf-8")
-
- task = stage_native_harbor_tasks(
- target,
- tmp_path / "native-multiline-decoy",
- verifier_env={"SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"},
- )[0]
-
- task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
- assert task_config["metadata"]["description"] == f"{decoy_header}\ndecoy\n"
- assert task_config["verifier"]["env"] == {
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
- }
-
-
@pytest.mark.parametrize("name", ["LLM_JUDGE_MODEL", "SKILL_EVAL_JUDGE_MODEL"])
@pytest.mark.parametrize(
- "authored_config",
+ ("authored_config", "expected_path"),
[
- '[verifier]\ntimeout_sec = 180.0\n\n[verifier.environment]\nworkdir = "/workspace"\n\n'
- '[verifier.environment.env]\n{name} = "skill-model"\n',
- '[[steps]]\nname = "step-one"\n\n[steps.verifier.env]\n{name} = "skill-model"\n',
- '[[steps]]\nname = "step-one"\n\n[steps.verifier.environment]\nworkdir = "/workspace"\n\n'
- '[steps.verifier.environment.env]\n{name} = "skill-model"\n',
+ (
+ '[verifier]\ntimeout_sec = 180.0\n\n[verifier.environment]\nworkdir = "/workspace"\n\n'
+ '[verifier.environment.env]\n{name} = "skill-model"\n',
+ ("verifier", "environment", "env"),
+ ),
+ (
+ '[[steps]]\nname = "step-one"\n\n[steps.verifier.env]\n{name} = "skill-model"\n',
+ ("steps", 0, "verifier", "env"),
+ ),
+ (
+ '[[steps]]\nname = "step-one"\n\n[steps.verifier.environment]\nworkdir = "/workspace"\n\n'
+ '[steps.verifier.environment.env]\n{name} = "skill-model"\n',
+ ("steps", 0, "verifier", "environment", "env"),
+ ),
],
)
-def test_native_tasks_reject_judge_model_controls_in_nested_verifier_envs(
+def test_native_tasks_preserve_judge_model_controls_in_nested_verifier_envs(
tmp_path: Path,
name: str,
authored_config: str,
+ expected_path: tuple[str | int, ...],
) -> None:
_, target, _, _ = _write_projection_fixture(tmp_path)
_write_minimal_native_task(target)
@@ -402,12 +345,23 @@ def test_native_tasks_reject_judge_model_controls_in_nested_verifier_envs(
encoding="utf-8",
)
- with pytest.raises(ValueError, match=rf"verifier.*{name}|{name}.*verifier"):
- stage_native_harbor_tasks(
- target,
- tmp_path / "native-nested-verifier-control",
- verifier_env={"SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}"},
- )
+ task = stage_native_harbor_tasks(
+ target,
+ tmp_path / "native-nested-verifier-control",
+ verifier_env={
+ "SKILL_EVAL_LLM_PROVIDER": "${SKILL_EVAL_LLM_PROVIDER}",
+ "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
+ },
+ )[0]
+
+ value: object = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
+ for segment in expected_path:
+ value = value[segment] # type: ignore[index]
+ assert value == {name: "skill-model"}
+ task_config = tomllib.loads((task / "task.toml").read_text(encoding="utf-8"))
+ assert task_config["verifier"]["env"] == {
+ "SKILL_EVAL_LLM_PROVIDER": "${SKILL_EVAL_LLM_PROVIDER}",
+ }
def test_native_task_staging_uses_one_private_evals_snapshot(
diff --git a/tests/test_tier3_public_runtime.py b/tests/test_tier3_public_runtime.py
index 5b45436e..2c733773 100644
--- a/tests/test_tier3_public_runtime.py
+++ b/tests/test_tier3_public_runtime.py
@@ -112,6 +112,26 @@ def test_native_environment_is_forwarded_to_harbor() -> None:
assert "--environment-import-path" not in command
+def test_judge_model_overrides_are_forwarded_only_as_harbor_verifier_env() -> None:
+ command = build_harbor_run_command(
+ dataset_path="/tmp/dataset",
+ agent="codex",
+ job_name="judge-model-test",
+ env_mode="docker",
+ verifier_env={
+ "LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
+ "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
+ },
+ )
+
+ forwarded = [command[index + 1] for index, value in enumerate(command) if value == "--verifier-env"]
+ assert forwarded == [
+ "LLM_JUDGE_MODEL=${LLM_JUDGE_MODEL}",
+ "SKILL_EVAL_JUDGE_MODEL=${SKILL_EVAL_JUDGE_MODEL}",
+ ]
+ assert "--agent-env" not in command
+
+
def test_nvidia_build_agent_import_selection_includes_local_bridge_agents() -> None:
provider = ProviderConfig(
provider="nv_build",
@@ -365,9 +385,7 @@ def test_generated_task_keeps_evaluator_provider_variables_out_of_agent_environm
task = tomllib.loads((tmp_path / "task.toml").read_text(encoding="utf-8"))
assert task["verifier"]["env"] == {
- "LLM_JUDGE_MODEL": "${LLM_JUDGE_MODEL}",
"NVIDIA_API_KEY": "${NVIDIA_API_KEY}",
- "SKILL_EVAL_JUDGE_MODEL": "${SKILL_EVAL_JUDGE_MODEL}",
"SKILL_EVAL_LLM_PROVIDER": "${SKILL_EVAL_LLM_PROVIDER}",
}
assert task["environment"]["env"] == {