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.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
feat(tier3): add experimental Hermes agent with native NVIDIA Build routing (#385)
Christopher Kevin782c800a878a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 726a13da..6832abb9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,11 @@ All notable changes to SkillEvaluator are documented in this file.### Added+- Experimental `hermes` Tier 3 agent for Docker and native NVIDIA Build routing,+ pinned to Hermes v2026.9.24. Includes isolated skill staging, ATIF trajectories,+ activation evidence, token accounting and retained execution diagnostics.+ Other providers/environments fail early; existing agent defaults are unchanged.+- Tier 3 generation provenance distinguishes LLM, requested-template, andtemplate-fallback datasets, marks trace refinement and autopilot generation,and displays the source and review state in terminal, HTML, and BENCHMARKdiff --git a/docs/agents-and-sandboxes.mdx b/docs/agents-and-sandboxes.mdxindex 81baa5a0..b40ce178 100644--- a/docs/agents-and-sandboxes.mdx+++ b/docs/agents-and-sandboxes.mdx@@ -18,14 +18,82 @@ local, and cloud environment backends.Pass agents as a comma-separated list with `-a/--agents`. Without that option,SkillEvaluator selects the provider-native default: `opencode` for NVIDIA Build,-`codex` for OpenAI, and `claude-code` for Anthropic. Three agents are supported:+`codex` for OpenAI, and `claude-code` for Anthropic. Three agents are supported,+with Hermes available as an explicit experimental option:| Agent | Notes || --- | --- || `claude-code` | Anthropic's Claude Code CLI. `claude` is an accepted alias. Harbor installs Claude Code 2.1.292. Claude 5.5 and later models run with `reasoning_effort=medium`; older models keep Claude Code's default effort. || `codex` | OpenAI's Codex CLI. The OpenAI-provider default. Harbor installs Codex 0.161.0. Runs with `reasoning_effort=high` so scores and cost stay comparable across Harbor releases. || `opencode` | The OpenCode CLI. Harbor installs OpenCode 1.19.5. |+| `hermes` | Experimental. Hermes v2026.9.24, Docker with NVIDIA Build only; no OpenRouter fallback. |++### Experimental Hermes++Hermes uses NVIDIA Build directly, not a protocol bridge. The initial matrix is+`--agents hermes --env-mode docker` with `SKILL_EVAL_LLM_PROVIDER=nv_build` and+`NVIDIA_API_KEY`. Local mode, Kata, cloud backends, and other evaluator providers+are rejected before execution. OpenCode remains the NVIDIA Build default.+The compatibility smoke uses Linux amd64, Docker Engine 29.9.3, Harbor 0.24.0,+and the Hermes/model versions below.++```bash title="Run Hermes with NVIDIA Build"+export SKILL_EVAL_LLM_PROVIDER=nv_build+export NVIDIA_API_KEY='nvapi-...'+skillevaluator doctor --agents hermes --env-mode docker+skillevaluator tier3 evaluate ./my-skill --agents hermes --env-mode docker \+ --harbor-keep-jobs+```++The Hermes default is `nvidia/nemotron-3.5-super-vl-120b-a12b`. Override it with+`--agent-model hermes=publisher/model` or `harbor.agents.hermes.model` in+`evals/config.yml`; model IDs must be full NVIDIA Build catalog IDs, without an+extra agent-provider prefix. Account access and tool support still depend on+the selected model. The grader model is independent; set+`SKILL_EVAL_LLM_MODEL` to a model your Build account can invoke for grading.++Harbor 0.24.0 supplies session export and ATIF conversion. SkillEvaluator pins+both the installer and checkout to Hermes commit+`f97608f178d1ffeca59860195ab7da295f7c8e5f` (v2026.9.24). The installer needs+GitHub and Python/Node package download access; first installs may take several+minutes. Browser and computer-use dependencies are not installed. Only the+selected NVIDIA credential reaches the agent; an ambient `OPENROUTER_API_KEY`+does not enable fallback.++Both arms use the same cases, inputs, model and grader. Hermes starts without+bundled skills or persistent memories; only evaluator-staged skills are copied+to `/tmp/hermes/skills`. Successful `skill_view` manifest reads and terminal+calls are normalized for the existing activation and grading checks. Failed+reads and support-file reads do not establish activation. Session export is+attempted on errors and timeouts too; a missing/malformed session or a session+without an agent response is an execution failure, not a scored skill defect.++Retained jobs include `trajectory.json` and `hermes.txt`; normal bounded,+redacted diagnostic retention applies. Token counts come from Hermes session+totals (or per-message usage when present); cost, cached tokens and other unreported fields remain+unknown rather than estimated as zero. Tool approval is noninteractive inside+the Docker sandbox, as for the other installed harnesses.++The repeatable smoke dataset is+[`tests/fixtures/skills/lookup-code`](https://github.com/NVIDIA/SkillEvaluator/tree/main/tests/fixtures/skills/lookup-code):+one script-backed skill lookup and one arithmetic non-trigger case. To validate+your own installation, run both arms without early stopping:++```bash title="Hermes compatibility smoke from a source checkout"+SKILL_EVAL_LLM_MODEL=nvidia/nemotron-3.5-super-vl-120b-a12b \+ skillevaluator tier3 evaluate tests/fixtures/skills/lookup-code \+ --agents hermes --env-mode docker --n-attempts 1 --n-concurrent 1 \+ --no-stop-on-pass --harbor-keep-jobs+```+An opt-in integration test checks the four trials, native activation, terminal+conversion, diagnostics and nonzero token usage. It installs the harness in+Docker and makes real API calls (including grading):++```bash+SKILL_EVAL_HERMES_INTEGRATION=1 python -m pytest -m integration \+ tests/test_hermes_agent.py -k real_hermes+```The pinned CLI releases apply wherever Harbor installs the agent: Docker andthe remote environments. [Local mode](#local-mode) runs the CLI already on yourmachine instead.diff --git a/docs/cli-reference.mdx b/docs/cli-reference.mdxindex 3f7e7f06..0e2b261f 100644--- a/docs/cli-reference.mdx+++ b/docs/cli-reference.mdx@@ -478,7 +478,7 @@ Use `skillevaluator tier3 PATH` for the complete workflow with automatic missing| Flag | Default | Effect || --- | --- | --- |-| `-a, --agents TEXT` | provider-native | Comma-separated Harbor agents. Defaults: NVIDIA Build=`opencode`, OpenAI=`codex`, Anthropic=`claude-code`. Supported: `claude-code`, `codex`, `opencode`; the alias `claude` is accepted for `claude-code`. See [Agents & Sandboxes](agents-and-sandboxes.mdx). |+| `-a, --agents TEXT` | provider-native | Comma-separated Harbor agents. Defaults: NVIDIA Build=`opencode`, OpenAI=`codex`, Anthropic=`claude-code`. Supported: `claude-code`, `codex`, `opencode`; Experimental: `hermes` (Docker with NVIDIA Build only; see [Experimental Hermes](agents-and-sandboxes.mdx#experimental-hermes)). The alias `claude` is accepted for `claude-code`. See [Agents & Sandboxes](agents-and-sandboxes.mdx). || `--env-mode` | `docker` | Where trials run. SkillEvaluator exposes 27 environment modes: 26 Harbor-native modes — `docker`, `daytona`, `e2b`, `modal`, `runloop`, `langsmith`, `ec2`, `gke`, `ack`, `openshift`, `novita`, `apple-container`, `singularity`, `islo`, `tensorlake`, `cwsandbox`, `wandb`, `use-computer`, `blaxel`, `beam`, `skypilot`, `hyperbrowser`, `vercel`, `kata`, `runta`, `mosaic` — plus SkillEvaluator `local` mode. `wandb` runs Harbor's `cwsandbox` backend with W&B authentication, so it needs the `harbor[cwsandbox]==0.24.0` extra; Harbor 0.24 has no `wandb` extra. Harbor's `cua-cloud`, `opensandbox`, `hf-sandbox`, `podman`, `prime`, and `smol` backends are not selectable. See the complete extras and prerequisites matrix in [Agents & Sandboxes](agents-and-sandboxes.mdx#where-trials-run). Installed packages can add more modes; see [Custom execution backends](agents-and-sandboxes.mdx#custom-execution-backends). || `--environment-kwarg`, `--ek` | none | Operator-only `KEY=VALUE` constructor option for Harbor-native non-Docker backends (repeatable). Values accept JSON-compatible types; skill-owned `evals/config.yml` cannot set them. Never pass secrets. Docker and local reject all kwargs, Kata accepts only `kata_runtime` and `kata_dns`, and Harbor runtime-policy fields for overrides, mounts, networks, extra Compose, lifecycle, and pod security are reserved, as are `stream`, `enable_environment_dir_upload`, and `auth` for `cwsandbox`/`wandb`. Names the selected backend does not accept in Harbor 0.24.0 are rejected. See [Native backend constructor options](agents-and-sandboxes.mdx#native-backend-constructor-options). || `--autopilot` | off | Create one eval case when no dataset/task source exists, then evaluate. The case is LLM-generated with the configured provider, with a deterministic keyless template fallback; an existing source is never overwritten. |diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.pyindex dd46e0e9..c79b00ed 100644--- a/src/skillevaluator/cli.py+++ b/src/skillevaluator/cli.py@@ -1994,7 +1994,7 @@ def _print_run_banner(target_path: Path, content_type: str, profile: str | None)cls=GroupedOption,help_group=_TIER3_GROUP,help=(- "Comma-separated Harbor agents. Default follows the provider: "+ "Comma-separated Harbor agents (hermes is experimental, Docker/NVIDIA Build only). Default follows the provider: ""NVIDIA Build=opencode, OpenAI=codex, Anthropic=claude-code."),)@@ -3165,7 +3165,7 @@ def _tier2_workflow("--agents",default=None,help=(- "Comma-separated Harbor agents (claude aliases claude-code). Default follows the provider: "+ "Comma-separated Harbor agents (claude aliases claude-code; hermes is experimental, Docker/NVIDIA Build only). Default follows the provider: ""NVIDIA Build=opencode, OpenAI=codex, Anthropic=claude-code."),)@@ -3643,7 +3643,7 @@ def _tier3_doctor_options(func):"--agents",default=None,help=(- "Comma-separated Harbor agents (claude aliases claude-code). Default follows the provider: "+ "Comma-separated Harbor agents (claude aliases claude-code; hermes is experimental, Docker/NVIDIA Build only). Default follows the provider: ""NVIDIA Build=opencode, OpenAI=codex, Anthropic=claude-code."),)(func)diff --git a/src/skillevaluator/tier3/generate_dataset.py b/src/skillevaluator/tier3/generate_dataset.pyindex 12ca8582..7f6b022c 100644--- a/src/skillevaluator/tier3/generate_dataset.py+++ b/src/skillevaluator/tier3/generate_dataset.py@@ -737,6 +737,7 @@ def _discover_trajectories("mini-swe-agent","aider","gemini-cli",+ "hermes",]for agent_name in agent_priority:trials_dir = results_dir / agent_name / "with-skill" / "trials"diff --git a/src/skillevaluator/tier3/harbor/__init__.py b/src/skillevaluator/tier3/harbor/__init__.pyindex d861c28f..e406c930 100644--- a/src/skillevaluator/tier3/harbor/__init__.py+++ b/src/skillevaluator/tier3/harbor/__init__.py@@ -25,6 +25,7 @@ from skillevaluator.tier3_environments import (# Local mode plugs into Harbor as a custom environment/agents via import paths.LOCAL_ENV_IMPORT_PATH = "skillevaluator.tier3.harbor.local_environment:SkillEvaluatorLocalEnvironment"+HERMES_VERSION = "v2026.9.24"LOCAL_HARBOR_AGENTS = frozenset({"claude-code", "codex", "opencode"})LOCAL_AGENT_IMPORT_PATHS = {"claude-code": "skillevaluator.tier3.harbor.local_agents:SkillEvaluatorLocalClaudeCode",@@ -49,6 +50,7 @@ LOCAL_CODEX_SECRETS_DIRNAME = "codex-secrets"DOCKER_AGENT_IMPORT_PATHS = {"codex": "skillevaluator.tier3.harbor.installed_agents:SkillEvaluatorCodex","claude-code": CONTAINER_AGENT_IMPORT_PATHS["claude-code"],+ "hermes": "skillevaluator.tier3.harbor.hermes_agent:SkillEvaluatorHermes",}HARBOR_AGENTS_SUPPORTED = frozenset(@@ -59,7 +61,7 @@ HARBOR_AGENTS_SUPPORTED = frozenset(})-HARBOR_AGENTS_EXPERIMENTAL: frozenset[str] = frozenset()+HARBOR_AGENTS_EXPERIMENTAL: frozenset[str] = frozenset({"hermes"})HARBOR_AGENTS = HARBOR_AGENTS_SUPPORTED | HARBOR_AGENTS_EXPERIMENTALdiff --git a/src/skillevaluator/tier3/harbor/adapter.py b/src/skillevaluator/tier3/harbor/adapter.pyindex acd81b1e..3ce13c64 100644--- a/src/skillevaluator/tier3/harbor/adapter.py+++ b/src/skillevaluator/tier3/harbor/adapter.py@@ -3565,6 +3565,8 @@ _AGENT_SKILL_PATHS = ["COPY skills/ /root/.config/opencode/skills/",]_RUNTIME_SKILL_DIRS = (+ "/tmp/hermes/skills",+ "/root/.hermes/skills","/etc/codex/skills","/tmp/codex-home/skills","/workspace/skills",@@ -3593,6 +3595,7 @@ _RUNTIME_SKILL_DIRS = ("/tmp/agent-home/sessions/skills",)_PROJECT_SKILL_RELATIVE_DIRS = (+ ".hermes/skills",".agents/skills",".claude/commands",".claude/skills",@@ -3796,9 +3799,11 @@ def _validate_runtime_loader_env(runtime_env: dict[str, str] | None) -> None:def _runtime_skill_reset_lines(agent_workdir: str | None = None) -> list[str]:"""Replace fixed, effective-home, and project-ancestor skill roots."""+ runtime_dirs_to_reset = ["/tmp/hermes" if path == "/tmp/hermes/skills" else path for path in _RUNTIME_SKILL_DIRS]+ runtime_dirs_to_create = [path for path in _RUNTIME_SKILL_DIRS if path != "/tmp/hermes/skills"]lines = [- "RUN " + json.dumps(["/bin/rm", "-rf", *_RUNTIME_SKILL_DIRS]),- "RUN " + json.dumps(["/bin/mkdir", "-p", *_RUNTIME_SKILL_DIRS]),+ "RUN " + json.dumps(["/bin/rm", "-rf", *runtime_dirs_to_reset]),+ "RUN " + json.dumps(["/bin/mkdir", "-p", *runtime_dirs_to_create]),"RUN " + json.dumps(["/bin/sh", "-c", _PROJECT_SKILL_ANCESTOR_RESET]),"RUN " + json.dumps(["/bin/sh", "-c", _HOME_SKILL_RESET]),"RUN " + json.dumps(["/bin/sh", "-c", _PASSWD_HOME_SKILL_RESET]),diff --git a/src/skillevaluator/tier3/harbor/collector.py b/src/skillevaluator/tier3/harbor/collector.pyindex fe61af90..da96434f 100644--- a/src/skillevaluator/tier3/harbor/collector.py+++ b/src/skillevaluator/tier3/harbor/collector.py@@ -130,6 +130,7 @@ AGENT_LOG_ARTIFACTS = ("gemini-cli.txt","cline.txt","opencode.txt",+ "hermes.txt",)GENERATED_AGENT_ARTIFACTS = ("lift.json",@@ -857,6 +858,8 @@ def _agent_log_runtime_failure_reason(trial_dir / "codex.txt",trial_dir / "agent" / "opencode.txt",trial_dir / "opencode.txt",+ trial_dir / "agent" / "hermes.txt",+ trial_dir / "hermes.txt",):text = _read_bounded_text(path)if text is None:diff --git a/src/skillevaluator/tier3/harbor/hermes_agent.py b/src/skillevaluator/tier3/harbor/hermes_agent.pynew file mode 100644index 00000000..4a0d9aca--- /dev/null+++ b/src/skillevaluator/tier3/harbor/hermes_agent.py@@ -0,0 +1,201 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0++"""Pinned, Docker-only Hermes execution through NVIDIA Build's native provider."""++from __future__ import annotations++import json+import os+import shlex+from typing import TYPE_CHECKING++from harbor.agents.installed.base import with_prompt_template+from harbor.agents.installed.hermes import Hermes++from skillevaluator.tier3.harbor import HERMES_VERSION++if TYPE_CHECKING:+ from harbor.environments.base import BaseEnvironment+ from harbor.models.agent.context import AgentContext+ from harbor.models.trajectories import Trajectory++HERMES_COMMIT = "f97608f178d1ffeca59860195ab7da295f7c8e5f"+_HOME = "/tmp/hermes"+++class SkillEvaluatorHermes(Hermes):+ """Keep Harbor's session/ATIF contract without its OpenRouter fallback."""++ def get_version_command(self) -> str:+ return 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; hermes --version'++ async def install(self, environment: BaseEnvironment) -> None:+ if self._version not in {None, HERMES_VERSION}:+ raise ValueError(f"SkillEvaluator Hermes requires {HERMES_VERSION}")+ self._version = HERMES_VERSION+ await self.ensure_system_dependencies(environment, ("curl", "git", "ripgrep", "xz"))+ await self.exec_as_agent(+ environment,+ command=(+ "set -euo pipefail; "+ f"curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/{HERMES_COMMIT}/scripts/install.sh "+ "-o /tmp/install-hermes.sh && "+ f"HERMES_HOME={_HOME} bash /tmp/install-hermes.sh --skip-setup --skip-browser "+ f"--skip-computer-use --no-skills --branch {HERMES_VERSION} --commit {HERMES_COMMIT} && "+ 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" && hermes --version'+ ),+ )++ @with_prompt_template+ async def run(self, instruction: str, environment: BaseEnvironment, context: AgentContext) -> None: # noqa: ARG002+ model = self.model_name or ""+ if model.count("/") != 1 or any(not part.strip() for part in model.split("/")):+ raise ValueError("Hermes requires a NVIDIA Build catalog model ID in publisher/model form")+ key = os.environ.get("NVIDIA_API_KEY", "").strip()+ if not key:+ raise ValueError("Hermes requires NVIDIA_API_KEY; OpenRouter fallback is disabled")+ self._last_run_was_resume = self._resume+ runtime_env = {+ "HERMES_HOME": _HOME,+ "TERMINAL_ENV": "local",+ "HERMES_BUNDLED_SKILLS": f"{_HOME}/empty-bundled-skills",+ }+ self.skills_dir = self.skills_dir or "/workspace/skills"+ config = self._build_config_yaml(model, self.options.max_turns)+ await self.exec_as_agent(+ environment,+ command=f"mkdir -p {_HOME}/empty-bundled-skills && cat > {_HOME}/config.yaml << 'EOF'\n{config}EOF",+ env=runtime_env,+ timeout_sec=10,+ )+ for command in (self._build_register_mcp_servers_command(), self._build_register_skills_command()):+ if command:+ await self.exec_as_agent(environment, command=command, env=runtime_env, timeout_sec=10)+ parts = [+ "hermes --yolo chat",+ '-q "$HARBOR_INSTRUCTION" -Q',+ f"--provider nvidia --model {shlex.quote(model)}",+ ]+ if self._resume:+ session_id = getattr(self, "_native_session_id", None)+ if not session_id:+ raise RuntimeError("Cannot resume Hermes: the previous run did not export a session ID")+ parts.append(f"--resume {shlex.quote(session_id)}")+ if self.options.toolsets:+ parts.append(f"--toolsets {shlex.quote(self.options.toolsets)}")+ try:+ await self.exec_as_agent(+ environment,+ command=(+ 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" && '+ f"{' '.join(parts)} 2>&1 | stdbuf -oL tee /logs/agent/hermes.txt"+ ),+ env={**runtime_env, "NVIDIA_API_KEY": key, "HARBOR_INSTRUCTION": instruction},+ )+ finally:+ # Export even after a nonzero exit or timeout; never replace the original error.+ try:+ result = await self.exec_as_agent(+ environment,+ command=(+ 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" && '+ "hermes sessions export /logs/agent/hermes-session.jsonl --source oneshot && "+ "test -s /logs/agent/hermes-session.jsonl && head -n 1 /logs/agent/hermes-session.jsonl"+ ),+ env=runtime_env,+ timeout_sec=30,+ )+ session_id = self._extract_native_session_id(result.stdout or "")+ if session_id:+ self._native_session_id = session_id+ except Exception:+ self.logger.warning("Hermes session export failed; inspect hermes.txt for execution diagnostics")++ def _convert_hermes_session_to_atif(self, jsonl_text: str, session_id: str) -> Trajectory | None:+ trajectory = super()._convert_hermes_session_to_atif(jsonl_text, session_id)+ if trajectory is None:+ return None+ # Pinned Hermes exports SQLite session totals, not per-message usage.+ sessions = []+ for line in jsonl_text.splitlines():+ try:+ record = json.loads(line)+ except ValueError:+ continue+ if isinstance(record, dict) and isinstance(record.get("messages"), list):+ sessions.append(record)+ if trajectory.final_metrics:+ for field, source in (+ ("total_prompt_tokens", "input_tokens"),+ ("total_completion_tokens", "output_tokens"),+ ):+ values = [record.get(source) for record in sessions]+ if (+ getattr(trajectory.final_metrics, field) is None+ and values+ and all(type(value) is int and value >= 0 for value in values)+ and sum(values) > 0+ ):+ setattr(trajectory.final_metrics, field, sum(values))+ for step in trajectory.steps:+ results = {result.source_call_id: result for result in step.observation.results} if step.observation else {}+ for call in step.tool_calls or []:+ if call.function_name not in {"terminal", "skill_view", "read_file"}:+ continue+ result = results.get(call.tool_call_id)+ try:+ payload = json.loads(result.content) if result and isinstance(result.content, str) else {}+ except (ValueError, TypeError):+ payload = {}+ if not isinstance(payload, dict):+ payload = {}+ if call.function_name == "terminal":+ call.function_name = "bash"+ exit_code = payload.get("exit_code")+ if result and (type(exit_code) is int or payload.get("error")):+ result.extra = {+ **(result.extra or {}),+ "tool_result_is_error": bool(payload.get("error")) or exit_code != 0,+ }+ elif call.function_name == "skill_view":+ # Only an observed successful manifest read is activation evidence.+ if payload.get("success") is True and payload.get("content") and not payload.get("error"):+ name = str(call.arguments.get("name", ""))+ file_path = str(call.arguments.get("file_path") or "SKILL.md")+ call.function_name = "read"+ call.arguments = {"path": f"{_HOME}/skills/{name}/{file_path}"}+ elif result:+ result.extra = {**(result.extra or {}), "tool_result_is_error": True}+ elif result:+ result.extra = {+ **(result.extra or {}),+ "tool_result_is_error": bool(payload.get("error")) or payload.get("success") is False,+ }+ return trajectory++ def populate_context_post_run(self, context: AgentContext) -> None:+ # A previous/resumed run's trajectory is not evidence for this execution.+ path = self.logs_dir / "trajectory.json"+ path.unlink(missing_ok=True)+ super().populate_context_post_run(context)+ trajectory = json.loads(path.read_text()) if path.is_file() else {}+ metrics = trajectory.get("final_metrics") or {}+ if metrics.get("total_prompt_tokens") is None:+ context.n_input_tokens = None+ if metrics.get("total_completion_tokens") is None:+ context.n_output_tokens = None+ if context.n_input_tokens is None or context.n_output_tokens is None:+ self._reported_session_metrics = None+ if not path.is_file():+ context.metadata = {+ **(context.metadata or {}),+ "hermes_session_error": "missing_or_invalid_session",+ }+ raise RuntimeError("Hermes produced no valid session trajectory; inspect hermes.txt and session export")+ if not any(step.get("source") == "agent" for step in trajectory.get("steps", [])):+ context.metadata = {+ **(context.metadata or {}),+ "hermes_session_error": "no_agent_response",+ }+ raise RuntimeError("Hermes session contains no agent response; inspect hermes.txt for provider errors")diff --git a/src/skillevaluator/tier3/harbor/native_agents.py b/src/skillevaluator/tier3/harbor/native_agents.pyindex e2f1a236..a24225ac 100644--- a/src/skillevaluator/tier3/harbor/native_agents.py+++ b/src/skillevaluator/tier3/harbor/native_agents.py@@ -40,6 +40,7 @@ from harbor.agents.installed.codex import Codexfrom harbor.agents.installed.hermes import Hermesfrom harbor.agents.installed.opencode import OpenCode+from skillevaluator.tier3.harbor.hermes_agent import SkillEvaluatorHermesfrom skillevaluator.tier3.harbor.installed_agents import SkillEvaluatorCodexfrom skillevaluator.tier3.harbor.local_agents import (SetupNetworkErrorAgent,@@ -290,6 +291,10 @@ class NativeHermes(_NativeHermesMixin, Hermes):"""Hermes with the load census written before launch."""+class NativeNvidiaBuildHermes(_NativeHermesMixin, SkillEvaluatorHermes):+ """Pinned NVIDIA Build Hermes with the load census written before launch."""++# Private baseline and wrapper arms need the same setup-phase error boundary# as native arms, without adding native setup, flags, or config to their launch.class PrivateClaudeCode(SetupNetworkErrorAgent, ClaudeCode):@@ -332,6 +337,10 @@ class PrivateHermes(SetupNetworkErrorAgent, Hermes):"""Stock Hermes with setup-only network error classification."""+class PrivateNvidiaBuildHermes(SetupNetworkErrorAgent, SkillEvaluatorHermes):+ """NVIDIA Build Hermes with setup-only network error classification."""++class PrivateLocalClaudeCode(SetupNetworkErrorAgent, SkillEvaluatorLocalClaudeCode):"""Local Claude Code with setup-only network error classification."""diff --git a/src/skillevaluator/tier3/harbor/runner.py b/src/skillevaluator/tier3/harbor/runner.pyindex cc5ddd98..a26535ba 100644--- a/src/skillevaluator/tier3/harbor/runner.py+++ b/src/skillevaluator/tier3/harbor/runner.py@@ -82,6 +82,7 @@ from skillevaluator.tier3.evals_config import (from skillevaluator.tier3.harbor import (CONTAINER_AGENT_IMPORT_PATHS,DOCKER_AGENT_IMPORT_PATHS,+ HERMES_VERSION,LOCAL_CODEX_HOME_DIRNAME,LOCAL_CODEX_SECRETS_DIRNAME,)@@ -1410,6 +1411,7 @@ _HARBOR_AGENT_KWARGS: Mapping[str, Mapping[str, str]] = MappingProxyType("codex": MappingProxyType({"reasoning_effort": "high", "version": _CODEX_VERSION}),"claude-code": MappingProxyType({"version": _CLAUDE_CODE_VERSION}),"opencode": MappingProxyType({"version": OPENCODE_VERSION}),+ "hermes": MappingProxyType({"version": HERMES_VERSION}),})# Claude Code's default effort depends on the model, and Claude Opus 5 ran at@@ -2030,6 +2032,15 @@ def _validate_agent_provider_credentials(model_sources = agent_model_sources or {}models = agent_models or {}+ if "hermes" in agents:+ if provider.provider != "nv_build" or env_mode != "docker":+ return ["Experimental hermes supports only NVIDIA Build with --env-mode docker."]+ if not agent_runtime_env.get("NVIDIA_API_KEY", "").strip():+ return ["hermes with NVIDIA Build requires NVIDIA_API_KEY."]+ model = models.get("hermes", "")+ if model and (model.count("/") != 1 or any(not part.strip() for part in model.split("/"))):+ return ["hermes requires a full NVIDIA Build catalog model ID in publisher/model form."]+opencode_model = models.get("opencode")expected_opencode_provider = {"anthropic": "anthropic",@@ -2136,7 +2147,7 @@ def _validate_agent_provider_credentials(]return []- unsupported = [agent for agent in agents if agent not in {"claude-code", "codex", "opencode"}]+ unsupported = [agent for agent in agents if agent not in {"claude-code", "codex", "opencode", "hermes"}]if unsupported:return ["nv_build does not support live agent(s): "@@ -3080,7 +3091,7 @@ def _agent_credentials() -> dict[str, str]:"""Resolve operator-owned credentials for exactly one agent runtime."""if provider.provider == "nv_build":- if agent == "opencode":+ if agent in {"opencode", "hermes"}:if env_mode == ENV_MODE_LOCAL:return _local_agent_credentials(provider)return {"NVIDIA_API_KEY": provider.api_key or ""}@@ -3572,6 +3583,8 @@ def _model_for_agent(# Provider-model, --model, --agent-model, and evals/config.yml overrides# stay exact for native OpenCode; bridge defaults remain compatibility-pinned.selected = _NVIDIA_BUILD_AGENT_DEFAULT_MODEL+ if agent == "hermes" and source == "public provider default" and provider.provider == "nv_build":+ selected = "nvidia/nemotron-3.5-super-vl-120b-a12b"if agent == "opencode":namespace = {"anthropic": "anthropic",@@ -3612,6 +3625,8 @@ def _agent_import_path(provider: ProviderConfig, agent: str, env_mode: str) -> sdef _provider_agent_import_path(provider: ProviderConfig, agent: str, env_mode: str) -> str | None:"""Select only the provider-specific wrappers required for this environment."""+ if agent == "hermes" and provider.provider == "nv_build" and env_mode == "docker":+ return DOCKER_AGENT_IMPORT_PATHS["hermes"]if provider.provider == "openai-compatible" and agent == "codex" and env_mode != ENV_MODE_LOCAL:return _GATEWAY_CODEX_IMPORT_PATHif provider.provider == "openai-compatible" and agent == "opencode" and env_mode in HARBOR_DOCKER_ENGINE_ENV_MODES:diff --git a/src/skillevaluator/tier3/plugin_native.py b/src/skillevaluator/tier3/plugin_native.pyindex 95314761..05aacfe2 100644--- a/src/skillevaluator/tier3/plugin_native.py+++ b/src/skillevaluator/tier3/plugin_native.py@@ -2296,6 +2296,7 @@ NATIVE_AGENT_IMPORT_PATHS: dict[tuple[str, str | None], str] = {("opencode", None): f"{_NATIVE_AGENTS}:NativeOpenCode",("opencode", f"{_LOCAL_AGENTS}:SkillEvaluatorGatewayOpenCode"): f"{_NATIVE_AGENTS}:NativeGatewayOpenCode",("hermes", None): f"{_NATIVE_AGENTS}:NativeHermes",+ ("hermes", "skillevaluator.tier3.harbor.hermes_agent:SkillEvaluatorHermes"): f"{_NATIVE_AGENTS}:NativeNvidiaBuildHermes",}diff --git a/tests/fixtures/skills/lookup-code/SKILL.md b/tests/fixtures/skills/lookup-code/SKILL.mdnew file mode 100644index 00000000..bd5af294--- /dev/null+++ b/tests/fixtures/skills/lookup-code/SKILL.md@@ -0,0 +1,9 @@+---+name: lookup-code+description: Look up the private sample code for a color using the bundled lookup script. Use only for sample-code lookup requests, not arithmetic.+---++# Sample code lookup++Run `python scripts/lookup.py COLOR` from this skill's directory. Report the+code printed by the script. Do not guess codes when the lookup is unavailable.diff --git a/tests/fixtures/skills/lookup-code/evals/evals.json b/tests/fixtures/skills/lookup-code/evals/evals.jsonnew file mode 100644index 00000000..fe0154d4--- /dev/null+++ b/tests/fixtures/skills/lookup-code/evals/evals.json@@ -0,0 +1,18 @@+[+ {+ "id": "lookup-positive",+ "question": "Use the lookup-code skill to look up the sample code for cobalt. Run its lookup script and report the code. If the skill is unavailable, say so rather than inventing a code.",+ "expected_skill": "lookup-code",+ "expected_script": "lookup.py",+ "ground_truth": "The cobalt sample code is ZX-731.",+ "expected_behavior": ["Load the lookup-code skill instructions", "Run the lookup script for cobalt", "Report ZX-731, not a guessed code"]+ },+ {+ "id": "arithmetic-negative",+ "question": "Use the terminal to calculate 17 times 19 and report the result. This is arithmetic, not a sample-code lookup.",+ "should_trigger": false,+ "expected_skill": "lookup-code",+ "ground_truth": "17 times 19 is 323.",+ "expected_behavior": ["Use a terminal calculation", "Report 323", "Do not activate lookup-code"]+ }+]diff --git a/tests/fixtures/skills/lookup-code/scripts/lookup.py b/tests/fixtures/skills/lookup-code/scripts/lookup.pynew file mode 100644index 00000000..b0a68582--- /dev/null+++ b/tests/fixtures/skills/lookup-code/scripts/lookup.py@@ -0,0 +1,7 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0++import sys++CODES = {"cobalt": "ZX-731", "amber": "QW-482"}+print(CODES[sys.argv[1]])diff --git a/tests/test_harbor_runtime_skill_isolation.py b/tests/test_harbor_runtime_skill_isolation.pyindex fb603e11..13f01f15 100644--- a/tests/test_harbor_runtime_skill_isolation.py+++ b/tests/test_harbor_runtime_skill_isolation.py@@ -2446,6 +2446,12 @@ def test_final_projection_clears_effective_workdir_ancestors_and_home(tmp_path:assert ".config/goose/skills" in dockerfileassert ".cline/skills" in dockerfileassert ".qwen/skills" in dockerfile+ runtime_reset = next(line for line in dockerfile.splitlines() if line.startswith('RUN ["/bin/rm", "-rf"'))+ runtime_mkdir = next(line for line in dockerfile.splitlines() if line.startswith('RUN ["/bin/mkdir", "-p"'))+ assert '"/tmp/hermes"' in runtime_reset+ assert '"/tmp/hermes/skills"' not in runtime_reset+ assert '"/tmp/hermes"' not in runtime_mkdir+ assert '"/tmp/hermes/skills"' not in runtime_mkdirassert "WORKDIR /opt/task/subdir" in dockerfile[final_projection:]assert dockerfile.rindex("current=$(/bin/pwd -P)") > dockerfile.rindex("COPY input/ /workspace/input/")task_toml = (task / "task.toml").read_text(encoding="utf-8")diff --git a/tests/test_hermes_agent.py b/tests/test_hermes_agent.pynew file mode 100644index 00000000..6d2790e9--- /dev/null+++ b/tests/test_hermes_agent.py@@ -0,0 +1,507 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0++"""Hermes compatibility at the public routing and Harbor artifact boundaries."""++from __future__ import annotations++import asyncio+import json+import os+import subprocess+import sys+from pathlib import Path+from types import SimpleNamespace+from unittest.mock import AsyncMock++import pytest++pytest.importorskip("harbor")+from harbor.agents.installed.base import NonZeroAgentExitCodeError+from harbor.models.agent.context import AgentContext+from harbor.models.task.task import Task+from harbor.models.trial.config import (+ AgentConfig as HarborAgentConfig,+)+from harbor.models.trial.config import (+ TaskConfig as HarborTaskConfig,+)+from harbor.models.trial.config import (+ TrialConfig,+ VerifierConfig,+)+from harbor.tasks.client import TaskDownloadResult+from harbor.trial.single_step import SingleStepTrial+from harbor.trial.trial import Trial++from skillevaluator.provider_config import ProviderConfig+from skillevaluator.tier3.commands import validate_agents+from skillevaluator.tier3.eval_core.atif_helpers import extract_tool_calls_as_dicts+from skillevaluator.tier3.eval_core.checks import check_activation+from skillevaluator.tier3.harbor import DOCKER_AGENT_IMPORT_PATHS, HARBOR_AGENTS_EXPERIMENTAL+from skillevaluator.tier3.harbor.adapter import generate_harbor_tasks+from skillevaluator.tier3.harbor.collector import AGENT_LOG_ARTIFACTS, _agent_log_runtime_failure_reason+from skillevaluator.tier3.harbor.hermes_agent import HERMES_COMMIT, HERMES_VERSION, SkillEvaluatorHermes+from skillevaluator.tier3.harbor.runner import (+ _agent_import_path,+ _harbor_agent_kwargs,+ _model_for_agent,+ _resolve_agent_runtime_plan,+ _validate_agent_provider_credentials,+ build_harbor_run_command,+)+++def _provider(name="nv_build"):+ return ProviderConfig(+ provider=name,+ model="nvidia/nemotron-3.5-super-vl-120b-a12b",+ api_key="selected-provider-key",+ base_url="https://integrate.api.nvidia.com/v1",+ litellm_model="openai/nvidia/nemotron-3.5-super-vl-120b-a12b",+ )+++def _agent(tmp_path):+ return SkillEvaluatorHermes(logs_dir=tmp_path, model_name=_provider().model)+++def _session(*, tool="skill_view", arguments=None, observation=None):+ return json.dumps(+ {+ "id": "native-session-id",+ "messages": [+ {"role": "user", "content": "Look up cobalt"},+ {+ "role": "assistant",+ "tool_calls": [+ {+ "id": "call-1",+ "function": {+ "name": tool,+ "arguments": json.dumps(arguments or {"name": "lookup-code"}),+ },+ }+ ],+ "usage": {"prompt_tokens": 100, "completion_tokens": 20},+ },+ {+ "role": "tool",+ "tool_call_id": "call-1",+ "content": json.dumps(observation or {"success": True, "content": "# Instructions"}),+ },+ {"role": "assistant", "content": "ZX-731"},+ ],+ }+ )+++def test_public_registration_and_pinned_docker_command(tmp_path):+ assert validate_agents(["hermes"]) == []+ assert "hermes" in HARBOR_AGENTS_EXPERIMENTAL+ assert _harbor_agent_kwargs("hermes", _provider().model, "docker") == {"version": HERMES_VERSION}+ assert _agent_import_path(_provider(), "hermes", "docker") == DOCKER_AGENT_IMPORT_PATHS["hermes"]+ command = build_harbor_run_command(+ dataset_path=tmp_path, agent="hermes", job_name="test", env_mode="docker", model=_provider().model+ )+ assert command[command.index("--agent") + 1] == DOCKER_AGENT_IMPORT_PATHS["hermes"]+ assert f'version="{HERMES_VERSION}"' in command++[email protected]("provider", ["openai", "anthropic", "openai-compatible", "bedrock"])+def test_unverified_providers_rejected(provider):+ errors = _validate_agent_provider_credentials(_provider(provider), ["hermes"], {"NVIDIA_API_KEY": "key"})+ assert "only NVIDIA Build" in errors[0]++[email protected]("mode", ["local", "kata", "gke", "daytona", "mosaic"])+def test_unverified_environments_rejected(mode):+ errors = _validate_agent_provider_credentials(_provider(), ["hermes"], {"NVIDIA_API_KEY": "key"}, env_mode=mode)+ assert "--env-mode docker" in errors[0]++[email protected]("model", ["nemotron", "openrouter/nvidia/model", "/model", "publisher/"])+def test_invalid_model_rejected(model):+ errors = _validate_agent_provider_credentials(+ _provider(), ["hermes"], {"NVIDIA_API_KEY": "key"}, agent_models={"hermes": model}+ )+ assert "publisher/model" in errors[0]+++def test_missing_credential_does_not_fall_back_to_openrouter(monkeypatch):+ monkeypatch.setenv("OPENROUTER_API_KEY", "unrelated-key")+ assert "NVIDIA_API_KEY" in _validate_agent_provider_credentials(_provider(), ["hermes"], {})[0]+++def test_model_precedence_and_credential_isolation(monkeypatch):+ monkeypatch.setenv("OPENROUTER_API_KEY", "unrelated-key")+ monkeypatch.setenv("OPENAI_API_KEY", "another-key")+ for cli, config, expected, source in (+ (None, {}, _provider().model, "public provider default"),+ (None, {"hermes": {"model": "publisher/configured"}}, "publisher/configured", "evals/config.yml"),+ ("publisher/override", {"hermes": {"model": "ignored"}}, "publisher/override", "CLI"),+ ):+ assert _model_for_agent("hermes", cli_model=cli, config_agents=config, provider=_provider()) == (+ expected,+ source,+ )+ plans = _resolve_agent_runtime_plan(+ provider=_provider(),+ agents=["hermes"],+ models={"hermes": _provider().model},+ configured_runtime_env={},+ env_mode="docker",+ )+ plan = plans["hermes"]+ assert dict(plan.staged_env) == {"NVIDIA_API_KEY": "${NVIDIA_API_KEY}"}+ assert plan.subprocess_env["NVIDIA_API_KEY"] == "selected-provider-key"+ assert "OPENROUTER_API_KEY" not in plan.subprocess_env+ assert "OPENAI_API_KEY" not in plan.subprocess_env+++def test_install_pins_script_checkout_and_disables_bundled_skills(tmp_path):+ agent = _agent(tmp_path)+ agent.ensure_system_dependencies = AsyncMock()+ agent.exec_as_agent = AsyncMock()+ asyncio.run(agent.install(SimpleNamespace()))+ command = agent.exec_as_agent.call_args.kwargs["command"]+ assert f"/{HERMES_COMMIT}/scripts/install.sh" in command+ assert f"--branch {HERMES_VERSION} --commit {HERMES_COMMIT}" in command+ assert "--no-skills" in command+ assert "main/" not in command+ assert "hermes --version" in command+ assert "hermes --version" in agent.get_version_command()+ assert agent.version() == HERMES_VERSION+++ "failure",+ [+ None,+ NonZeroAgentExitCodeError("provider failed"),+ TimeoutError("timed out"),+ asyncio.CancelledError("cancelled"),+ ],+)+def test_native_invocation_exports_session_even_on_failure(tmp_path, monkeypatch, failure):+ monkeypatch.setenv("NVIDIA_API_KEY", "selected-provider-key")+ monkeypatch.setenv("OPENROUTER_API_KEY", "unrelated-key")+ agent = _agent(tmp_path)+ calls = []++ async def execute(_environment, **kwargs):+ calls.append(kwargs)+ if "hermes --yolo chat" in kwargs["command"] and failure:+ raise failure+ return SimpleNamespace(stdout=_session(), return_code=0)++ agent.exec_as_agent = execute+ if failure:+ with pytest.raises(type(failure), match=str(failure)):+ asyncio.run(agent.run("untrusted ' prompt\nEOF", SimpleNamespace(), AgentContext()))+ else:+ asyncio.run(agent.run("untrusted ' prompt\nEOF", SimpleNamespace(), AgentContext()))+ launch = next(call for call in calls if "hermes --yolo chat" in call["command"])+ assert "--provider nvidia --model nvidia/nemotron-3.5-super-vl-120b-a12b" in launch["command"]+ assert set(launch["env"]) == {+ "HERMES_HOME",+ "TERMINAL_ENV",+ "HERMES_BUNDLED_SKILLS",+ "NVIDIA_API_KEY",+ "HARBOR_INSTRUCTION",+ }+ assert launch["env"]["HERMES_BUNDLED_SKILLS"] == "/tmp/hermes/empty-bundled-skills"+ assert any("mkdir -p /tmp/hermes/empty-bundled-skills" in call["command"] for call in calls)+ assert "selected-provider-key" not in launch["command"]+ assert "untrusted" not in launch["command"]+ assert "sessions export" in calls[-1]["command"]+ assert "NVIDIA_API_KEY" not in calls[-1]["env"]+ assert agent._native_session_id == "native-session-id"+ assert any("cp -r /workspace/skills/" in call["command"] for call in calls)+++ ("tool", "observation", "arguments", "activated"),+ [+ ("skill_view", {"success": True, "content": "# Instructions"}, {"name": "lookup-code"}, True),+ ("skill_view", {"success": False, "error": "not found"}, {"name": "lookup-code"}, False),+ (+ "skill_view",+ {"success": True, "content": "reference"},+ {"name": "lookup-code", "file_path": "references/help.md"},+ False,+ ),+ ("skill_view", {"success": True, "content": "other"}, {"name": "another-skill"}, False),+ (+ "read_file",+ {"error": "File not found: /tmp/hermes/skills/lookup-code/SKILL.md"},+ {"path": "/tmp/hermes/skills/lookup-code/SKILL.md"},+ False,+ ),+ (+ "read_file",+ {"success": False},+ {"path": "/tmp/hermes/skills/lookup-code/SKILL.md"},+ False,+ ),+ (+ "read_file",+ "The skill manifest contents",+ {"path": "/tmp/hermes/skills/lookup-code/SKILL.md"},+ True,+ ),+ ],+)+def test_atif_skill_activation_requires_successful_target_manifest(tmp_path, tool, observation, arguments, activated):+ trajectory = _agent(tmp_path)._convert_hermes_session_to_atif(+ _session(tool=tool, observation=observation, arguments=arguments), "session"+ )+ calls = extract_tool_calls_as_dicts(trajectory.to_json_dict())+ assert check_activation(calls, "lookup-code")["passed"] is activated+ assert calls[0]["observation"]+++def test_terminal_conversion_and_token_context(tmp_path):+ agent = _agent(tmp_path)+ text = _session(tool="terminal", arguments={"command": "python lookup.py cobalt"})+ (tmp_path / "hermes-session.jsonl").write_text(text)+ context = AgentContext()+ agent.populate_context_post_run(context)+ assert (context.n_input_tokens, context.n_output_tokens) == (100, 20)+ assert context.cost_usd is None+ trajectory = json.loads((tmp_path / "trajectory.json").read_text())+ calls = extract_tool_calls_as_dicts(trajectory)+ assert calls[0]["action"] == "bash"+ assert calls[0]["action_input"]["command"] == "python lookup.py cobalt"++[email protected]("result", [{"exit_code": 1}, {"error": "timed out"}, {"exit_code": 0}])+def test_terminal_failed_reads_cannot_prove_activation(tmp_path, result):+ trajectory = _agent(tmp_path)._convert_hermes_session_to_atif(+ _session(+ tool="terminal",+ arguments={"command": "cat /tmp/hermes/skills/lookup-code/SKILL.md"},+ observation={"output": "skill content or command error", **result},+ ),+ "session",+ )+ calls = extract_tool_calls_as_dicts(trajectory.to_json_dict())+ succeeded = result == {"exit_code": 0}+ assert calls[0]["is_error"] is not succeeded+ assert check_activation(calls, "lookup-code")["passed"] is succeeded+++ ("text", "error_reason"),+ [+ (None, "missing_or_invalid_session"),+ ("", "missing_or_invalid_session"),+ ("malformed", "missing_or_invalid_session"),+ (+ '{"id":"session","messages":[{"role":"user","content":"Look up cobalt"}]}',+ "no_agent_response",+ ),+ ],+)+def test_missing_or_malformed_session_is_execution_failure(tmp_path, text, error_reason):+ if text is not None:+ (tmp_path / "hermes-session.jsonl").write_text(text)+ context = AgentContext()+ agent = _agent(tmp_path)+ agent._reported_session_metrics = ("stale-session", 100, 20)+ with pytest.raises(RuntimeError, match="Hermes"):+ agent.populate_context_post_run(context)+ assert context.metadata == {"hermes_session_error": error_reason}+ assert context.n_input_tokens is None+ assert context.n_output_tokens is None+ assert agent._reported_session_metrics is None+++def test_harbor_trial_run_recovers_missing_hermes_session_as_execution_failure(tmp_path, monkeypatch):+ skill = Path(__file__).parent / "fixtures" / "skills" / "lookup-code"+ task_dir = generate_harbor_tasks(skill, tmp_path / "tasks", with_skill=True)[0]+ task = Task(task_dir, disable_verification=True)+ config = TrialConfig(+ task=HarborTaskConfig(path=task_dir),+ trial_name="hermes-missing-session",+ trials_dir=tmp_path / "trials",+ agent=HarborAgentConfig(+ import_path=DOCKER_AGENT_IMPORT_PATHS["hermes"],+ model_name=_provider().model,+ kwargs={"version": HERMES_VERSION},+ ),+ verifier=VerifierConfig(disable=True),+ )+ download = TaskDownloadResult(path=task_dir, download_time_sec=0, cached=True)++ def initialize_agent_environment(trial):+ trial.agent_environment = SimpleNamespace()++ async def no_prepare(_trial):+ pass++ async def no_agent_phase(_trial, *, target, **_kwargs):+ target.agent_result = AgentContext()++ async def no_download_agent_logs(_trial):+ pass++ async def no_collect_artifacts(_trial, **_kwargs):+ pass++ async def no_stop_agent_environment(_trial):+ pass++ monkeypatch.setattr(Trial, "_init_agent_environment", initialize_agent_environment)+ monkeypatch.setattr(Trial, "_init_artifact_handler", lambda _trial: None)+ monkeypatch.setattr(Trial, "_prepare", no_prepare)+ monkeypatch.setattr(Trial, "_run_agent_phase", no_agent_phase)+ monkeypatch.setattr(Trial, "_download_agent_logs", no_download_agent_logs)+ monkeypatch.setattr(SingleStepTrial, "_collect_artifacts", no_collect_artifacts)+ monkeypatch.setattr(Trial, "_stop_agent_environment", no_stop_agent_environment)++ trial = SingleStepTrial(config, _task=task, _task_download_result=download)+ result = asyncio.run(trial.run())++ assert result.exception_info is not None+ assert result.agent_result.metadata == {"hermes_session_error": "missing_or_invalid_session"}+++def test_resume_requires_exported_session_id(tmp_path, monkeypatch):+ monkeypatch.setenv("NVIDIA_API_KEY", "selected-provider-key")+ agent = _agent(tmp_path)+ agent._resume = True+ agent.exec_as_agent = AsyncMock()+ with pytest.raises(RuntimeError, match="previous run did not export"):+ asyncio.run(agent.run("resume", SimpleNamespace(), AgentContext()))+ assert not any("hermes --yolo chat" in call.kwargs["command"] for call in agent.exec_as_agent.call_args_list)+++def test_diagnostic_retention_and_provider_failure_detection(tmp_path):+ assert "hermes.txt" in AGENT_LOG_ARTIFACTS+ (tmp_path / "hermes.txt").write_text("Error: 401 Unauthorized: invalid API key")+ assert _agent_log_runtime_failure_reason(tmp_path)+++def test_unknown_usage_is_not_zero(tmp_path):+ record = json.loads(_session())+ del record["messages"][1]["usage"]+ (tmp_path / "hermes-session.jsonl").write_text(json.dumps(record))+ context = AgentContext()+ _agent(tmp_path).populate_context_post_run(context)+ assert context.n_input_tokens is None+ assert context.n_output_tokens is None+ assert context.cost_usd is None+++def test_pinned_session_totals_and_resume_usage_are_not_double_counted(tmp_path):+ agent = _agent(tmp_path)+ record = json.loads(_session())+ del record["messages"][1]["usage"]+ for resume, input_tokens, output_tokens, expected in (+ (False, 500, 40, (500, 40)),+ (True, 700, 55, (200, 15)),+ ):+ record.update(input_tokens=input_tokens, output_tokens=output_tokens)+ (tmp_path / "hermes-session.jsonl").write_text(json.dumps(record))+ agent._last_run_was_resume = resume+ context = AgentContext()+ agent.populate_context_post_run(context)+ assert (context.n_input_tokens, context.n_output_tokens) == expected+ record["messages"][1]["usage"] = {"prompt_tokens": 100, "completion_tokens": 20}+ trajectory = agent._convert_hermes_session_to_atif(json.dumps(record), "session")+ assert trajectory.final_metrics.total_prompt_tokens == 100+++def test_stale_trajectory_cannot_hide_missing_session(tmp_path):+ (tmp_path / "trajectory.json").write_text('{"steps": [{"source": "agent"}]}')+ with pytest.raises(RuntimeError, match="no valid session"):+ _agent(tmp_path).populate_context_post_run(AgentContext())+++def test_matched_arms_preserve_cases_grading_inputs_and_skill_isolation(tmp_path):+ skill = Path(__file__).parent / "fixtures" / "skills" / "lookup-code"+ with_tasks = {task.name: task for task in generate_harbor_tasks(skill, tmp_path / "with", with_skill=True)}+ without_tasks = {task.name: task for task in generate_harbor_tasks(skill, tmp_path / "without", with_skill=False)}+ assert set(with_tasks) == set(without_tasks) == {"lookup-positive", "arithmetic-negative"}+ for case_id, task in with_tasks.items():+ baseline = without_tasks[case_id]+ assert (task / "instruction.md").read_bytes() == (baseline / "instruction.md").read_bytes()+ for filename in ("skill_evaluator/eval.py", "test.sh"):+ assert (task / "tests" / filename).read_bytes() == (baseline / "tests" / filename).read_bytes()+ with_entry = json.loads((task / "tests" / "entry.json").read_text())+ without_entry = json.loads((baseline / "tests" / "entry.json").read_text())+ assert with_entry.pop("has_skill") is True+ assert without_entry.pop("has_skill") is False+ assert with_entry == without_entry+ assert list((task / "environment").rglob("lookup.py"))+ assert not list((baseline / "environment").rglob("lookup.py"))+++ os.environ.get("SKILL_EVAL_HERMES_INTEGRATION") != "1",+ reason="Opt in with SKILL_EVAL_HERMES_INTEGRATION=1; installs Hermes and makes paid NVIDIA Build calls",+)+def test_real_hermes_docker_matched_arms(tmp_path):+ if not os.environ.get("NVIDIA_API_KEY"):+ pytest.skip("NVIDIA_API_KEY is required")+ skill = Path(__file__).parent / "fixtures" / "skills" / "lookup-code"+ completed = subprocess.run(+ [+ str(Path(sys.executable).with_name("skillevaluator")),+ "tier3",+ "evaluate",+ str(skill),+ "--agents",+ "hermes",+ "--env-mode",+ "docker",+ "--n-attempts",+ "1",+ "--n-concurrent",+ "2",+ "--max-agents",+ "1",+ "--no-stop-on-pass",+ "--harbor-keep-jobs",+ "--results-dir",+ str(tmp_path / "results"),+ ],+ env={+ **os.environ,+ "SKILL_EVAL_LLM_PROVIDER": "nv_build",+ "SKILL_EVAL_LLM_MODEL": _provider().model,+ },+ capture_output=True,+ timeout=3600,+ check=False,+ )+ assert completed.returncode == 0, "Hermes smoke failed; inspect the retained results directory"+ _assert_real_hermes_artifacts(tmp_path / "results")+++def _assert_real_hermes_artifacts(results_dir):+ trials = list(results_dir.glob("**/_harbor-jobs/*/*/result.json"))+ assert len(trials) == 4+ for result_path in trials:+ result = json.loads(result_path.read_text())+ assert result.get("exception_info") is None+ assert result["agent_result"]["n_input_tokens"] > 0+ assert result["agent_result"]["n_output_tokens"] > 0+ agent_dir = result_path.parent / "agent"+ assert (agent_dir / "hermes.txt").is_file()+ trajectory = json.loads((agent_dir / "trajectory.json").read_text())+ calls = extract_tool_calls_as_dicts(trajectory)+ expected_activation = result_path.parent.name.startswith(+ "lookup-positive__"+ ) and result_path.parent.parent.name.endswith("-with")+ assert check_activation(calls, "lookup-code")["passed"] is expected_activation+ if expected_activation:+ assert any(+ call["action"] == "bash" and "lookup.py" in call["action_input"].get("command", "") for call in calls+ )+ assert result["verifier_result"]["rewards"]["goal_accuracy"] == 1.0+ if result_path.parent.name.startswith("arithmetic-negative__"):+ assert any(call["action"] == "bash" for call in calls)+ assert result["verifier_result"]["rewards"]["goal_accuracy"] == 1.0diff --git a/tests/tier3/test_generate_dataset_results.py b/tests/tier3/test_generate_dataset_results.pyindex 11188d4e..d7cc0d97 100644--- a/tests/tier3/test_generate_dataset_results.py+++ b/tests/tier3/test_generate_dataset_results.py@@ -65,6 +65,26 @@ def test_discover_trajectories_opencode_txt_fallback(tmp_path):assert trajectories["case-001"].get("steps")+def test_discover_trajectories_finds_hermes_only_run(tmp_path):+ skill = tmp_path / "demo"+ skill.mkdir()+ results_root = tmp_path / "results"+ skill_results = results_root / "demo"+ run_id = "20260709_120000"+ run_dir = skill_results / run_id+ trial = run_dir / "hermes" / "with-skill" / "trials" / "lookup-positive"+ trial.mkdir(parents=True)+ trajectory = {"steps": [{"tool_calls": [{"tool": "Read"}]}]}+ (trial / "trajectory.json").write_text(json.dumps(trajectory), encoding="utf-8")+ (run_dir / "run_config.json").write_text("{}", encoding="utf-8")+ (run_dir / "result.json").write_text(json.dumps({"run_id": run_id}), encoding="utf-8")+ (skill_results / "latest").symlink_to(run_id)++ found = _discover_trajectories(skill, results_dir=results_root)++ assert found == {"lookup-positive": trajectory}++def test_discover_trajectories_opencode_maps_harbor_folder_via_result_metadata(tmp_path):skill = tmp_path / "demo"skill.mkdir()