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
fix(tier3): handle malformed mcp_servers.toml on NeMo Gym as Harbor does (#656)
Christopher Kevindefc6bddf381
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 68e7a823..1abaed22 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -315,6 +315,9 @@ All notable changes to SkillEvaluator are documented in this file.- Fully budget-denied runs exit successfully and finish progress without anexecution error, while retaining skipped arms and an incomplete quality verdict.+- `--backend nemo-gym` no longer rejects a malformed `evals/environment/mcp_servers.toml`+ as "not supported". As on Harbor, the parse error is logged and the run continues+ without MCP servers; a file that declares servers is still rejected.- `--backend nemo-gym` no longer writes a second `[verifier.env]` table into anative task's `task.toml` when its header has a trailing comment, extra spacesor no final newline. The duplicate table made the file fail to parse.diff --git a/src/skillevaluator/tier3/nemo_gym/backend.py b/src/skillevaluator/tier3/nemo_gym/backend.pyindex f8b4a753..a6ebc966 100644--- a/src/skillevaluator/tier3/nemo_gym/backend.py+++ b/src/skillevaluator/tier3/nemo_gym/backend.py@@ -314,24 +314,26 @@ def uses_native_harbor_tasks(skill_path: Path, task_source: object) -> bool:return not has_evals_file and (skill_path / "evals" / "harbor").is_dir()-def mcp_servers_declared(skill_path: Path) -> bool:- """Return True when ``evals/environment/mcp_servers.toml`` declares any MCP server."""- from skillevaluator.tier3.harbor.adapter import _load_mcp_servers-- if not (skill_path / "evals" / "environment" / "mcp_servers.toml").is_file():- return False- try:- return bool(_load_mcp_servers(skill_path))- except Exception:- return True--MCP_SERVERS_ERROR = "evals/environment/mcp_servers.toml is not supported with --backend nemo-gym yet"NATIVE_MCP_SERVERS_ERROR = ("[[environment.mcp_servers]] in a native task.toml is not supported with --backend nemo-gym yet")+def mcp_servers_error(skill_path: Path) -> str | None:+ """Return why ``evals/environment/mcp_servers.toml`` blocks a Gym run, or None when it does not."""+ from skillevaluator.tier3.harbor.adapter import _load_mcp_servers++ if not (skill_path / "evals" / "environment" / "mcp_servers.toml").is_file():+ return None+ try:+ declared = bool(_load_mcp_servers(skill_path))+ except Exception as exc:+ # The message can quote raw field values, including credentials: name only the error type.+ return f"evals/environment/mcp_servers.toml is invalid ({type(exc).__name__})"+ return MCP_SERVERS_ERROR if declared else None++def native_mcp_servers_declared(skill_path: Path) -> bool:"""Return True when a native ``evals/harbor/*/task.toml`` declares ``[[environment.mcp_servers]]``."""import tomllib@@ -377,8 +379,8 @@ def nemo_gym_config_errors(errors.append("harbor.stop_on_pass is not supported with --backend nemo-gym yet")if agent_runtime_preflight is None and harbor.get("agent_runtime_preflight"):errors.append("harbor.agent_runtime_preflight applies to the Harbor backend only")- if mcp_servers_declared(skill_path):- errors.append(MCP_SERVERS_ERROR)+ if mcp_error := mcp_servers_error(skill_path):+ errors.append(mcp_error)if uses_native_harbor_tasks(skill_path, harbor.get("task_source", "auto")) and native_mcp_servers_declared(skill_path):diff --git a/src/skillevaluator/tier3/nemo_gym/runner.py b/src/skillevaluator/tier3/nemo_gym/runner.pyindex 7de536e2..c75c1c5e 100644--- a/src/skillevaluator/tier3/nemo_gym/runner.py+++ b/src/skillevaluator/tier3/nemo_gym/runner.py@@ -35,7 +35,6 @@ from skillevaluator.tier3.harbor.progress import ()from skillevaluator.tier3.nemo_gym.backend import (DEFAULT_RUN_TIMEOUT_S,- MCP_SERVERS_ERROR,MODEL_API_KEY_ENV,MODEL_URL_ENV,NATIVE_MCP_SERVERS_ERROR,@@ -43,7 +42,7 @@ from skillevaluator.tier3.nemo_gym.backend import (NEMO_GYM_BACKEND,NEMO_GYM_BIN_ENV,RUN_TIMEOUT_ENV,- mcp_servers_declared,+ mcp_servers_error,model_url_credential_error,native_mcp_servers_declared,nemo_gym_bin,@@ -970,8 +969,8 @@ def run_nemo_gym_eval(errors.append("No native Harbor task source found at evals/harbor.")if task_source == "evals_json" and find_evals_file(skill_path) is None:errors.append(_MISSING_EVALS_DATASET_ERROR)- if mcp_servers_declared(skill_path):- errors.append(MCP_SERVERS_ERROR)+ if mcp_error := mcp_servers_error(skill_path):+ errors.append(mcp_error)if task_source == "native_harbor" and native_mcp_servers_declared(skill_path):errors.append(NATIVE_MCP_SERVERS_ERROR)pre_agent_setup = list(harbor_config.get("pre_agent_setup") or [])diff --git a/tests/test_nemo_gym_backend.py b/tests/test_nemo_gym_backend.pyindex 5f25c9ae..6b65ef2c 100644--- a/tests/test_nemo_gym_backend.py+++ b/tests/test_nemo_gym_backend.py@@ -2024,6 +2024,26 @@ def test_rollout_row_failures_are_redacted(tmp_path: Path, monkeypatch: pytest.Massert all(secret not in path.read_text() for path in run_dir.rglob("*.json"))+def test_malformed_mcp_servers_toml_is_handled_as_on_harbor(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:+ from skillevaluator.tier3.nemo_gym.backend import MCP_SERVERS_ERROR, nemo_gym_config_errors++ skill = tmp_path / "calc"+ (skill / "evals" / "environment").mkdir(parents=True)+ (skill / "SKILL.md").write_text("---\nname: calc\ndescription: Adds numbers.\n---\n# Calc\n")+ mcp = skill / "evals" / "environment" / "mcp_servers.toml"+ mcp.write_text('[[mcp_servers]\nname = "x"\n')+ # Harbor logs the parse error and runs without MCP servers; Gym does the same.+ assert MCP_SERVERS_ERROR not in nemo_gym_config_errors(skill)+ assert "Failed to parse" in caplog.text+ mcp.write_text('[[mcp_servers]]\nname = "x"\nurl = "http://127.0.0.1:9/mcp"\n')+ assert MCP_SERVERS_ERROR in nemo_gym_config_errors(skill)+ mcp.write_text(+ '[[mcp_servers]]\nname = "x"\nurl = "http://127.0.0.1:9/mcp"\nheaders = "Bearer sk-not-a-table-1234"\n'+ )+ invalid = [error for error in nemo_gym_config_errors(skill) if "mcp_servers.toml is invalid" in error]+ assert invalid and "sk-not-a-table-1234" not in invalid[0]++def test_cli_checks_gym_settings_before_autopilot_writes_a_dataset(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: