Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ All notable changes to SkillEvaluator are documented in this file.

### Fixed

- Tier 3 Harbor dual-arm evaluation propagates arm suffixes (`-with-skill`,
`-without-skill`) to `[task] name` in staged native `task.toml` files,
normalizes external repository and namespace prefixes, and commutatively
resolves canonical case IDs across attempt and arm suffix combinations
while preserving expected case IDs.
- Preserve full Codex gateway model IDs in cloud environments, including E2B
and Daytona, while retaining local runtime setup and native provider routing.
- Keep Tier 2 execution diagnostics visible alongside duplicate findings in
Expand Down
52 changes: 51 additions & 1 deletion src/skillevaluator/tier3/harbor/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@ def _write_task_toml(
pre_agent_setup: list[str] | None = None,
task_resources: dict[str, int] | None = None,
agent_workdir: str | None = None,
arm_suffix: str = "",
) -> None:
entry_id = entry.get("id", "unknown")
expected_skill = entry.get("expected_skill") or "none"
Expand All @@ -1803,16 +1804,19 @@ def _write_task_toml(
raise TypeError("expected_skill must be a string before Harbor TOML serialization")
if not isinstance(docker_image, str):
raise TypeError("docker_image must be a string before Harbor TOML serialization")
if not isinstance(arm_suffix, str):
raise TypeError("arm_suffix must be a string before Harbor TOML serialization")
docker_image_line = f"docker_image = {_toml_quote(docker_image)}\n" if docker_image else ""
cpus = _task_resource_value(task_resources, "cpus", 2)
memory_mb = _task_resource_value(task_resources, "memory_mb", 4096)
storage_mb = _task_resource_value(task_resources, "storage_mb", 2048)
workdir_line = f"workdir = {_toml_quote(agent_workdir)}\n" if agent_workdir else ""

task_name = f"nvidia/skillevaluator-{entry_id}{arm_suffix}"
content = f"""schema_version = "1.3"

[task]
name = {_toml_quote(f"nvidia/skillevaluator-{entry_id}")}
name = {_toml_quote(task_name)}
description = {_toml_quote(f"Skill evaluation task for {expected_skill}")}

[metadata]
Expand Down Expand Up @@ -4225,6 +4229,32 @@ def _native_entry_id(task_dir: Path) -> str:
return task_dir.name


def _append_native_task_name_suffix(task_dir: Path, arm_suffix: str) -> None:
"""Append dual-arm suffix to [task] name in a native task's task.toml."""
if not arm_suffix:
return
task_toml = task_dir / "task.toml"
if not task_toml.exists():
return
content = task_toml.read_text(encoding="utf-8")

pattern = r'(?ms)(\[task\]\s*?\n(?:(?!\[)[^\n]*\n)*?\s*name\s*=\s*)(["\'])(.*?)\2'
Comment thread
rng1995 marked this conversation as resolved.
Resolved

def _repl(m: re.Match[str]) -> str:
prefix, quote, old_name = m.groups()
if old_name.endswith(arm_suffix):
return m.group(0)
Comment thread
rng1995 marked this conversation as resolved.
Resolved
return f"{prefix}{quote}{old_name}{arm_suffix}{quote}"

new_content, count = re.subn(pattern, _repl, content, count=1)
if count == 0:
fallback_pattern = r'(?m)^(\s*name\s*=\s*)(["\'])(.*?)\2'
new_content = re.sub(fallback_pattern, _repl, content, count=1)

if new_content != content:
task_toml.write_text(new_content, encoding="utf-8")


def _environment_reference_names(value: object) -> set[str]:
"""Return portable shell-style environment references from a TOML value."""
if not isinstance(value, str):
Expand Down Expand Up @@ -4579,12 +4609,15 @@ def _stage_native_harbor_tasks_into(
task_resources: dict[str, int] | None = None,
agent_workdir: str | None = None,
baseline_aliases_prevalidated: bool = False,
arm_suffix: str = "",
) -> list[Path]:
"""Build native Harbor tasks inside a private, caller-owned directory.

The source tree is copied first and all SkillEvaluator injections happen only in the
staged result directory.
"""
if not isinstance(arm_suffix, str):
raise TypeError("arm_suffix must be a string before staging native Harbor tasks")
_validate_runtime_discovery_env(runtime_env)
_validate_runtime_loader_env(runtime_env)
evals_dir = evaluator_skill_path / "evals"
Expand Down Expand Up @@ -4636,6 +4669,7 @@ def _stage_native_harbor_tasks_into(
baseline_aliases_prevalidated = True
for task_dir in task_dirs:
entry_id = _native_entry_id(task_dir)
_append_native_task_name_suffix(task_dir, arm_suffix)
native_agent_workdir = _native_task_workdir(task_dir)
_ensure_native_skills_dir(task_dir)
entry = entries_by_id.get(entry_id)
Expand Down Expand Up @@ -4767,9 +4801,13 @@ def stage_native_harbor_tasks(
agent_workdir: str | None = None,
evaluator_skill_path: Path | None = None,
_baseline_alias_validation: _BaselineAliasValidation | None = None,
arm_suffix: str = "",
) -> list[Path]:
"""Stage native tasks privately, then publish one exact output snapshot."""

if not isinstance(arm_suffix, str):
raise TypeError("arm_suffix must be a string before staging native Harbor tasks")

if evaluator_skill_path is None:
with private_evaluator_skill_snapshot(skill_path, task_source="native_harbor") as private_skill_path:
return stage_native_harbor_tasks(
Expand All @@ -4791,6 +4829,7 @@ def stage_native_harbor_tasks(
agent_workdir=agent_workdir,
evaluator_skill_path=private_skill_path,
_baseline_alias_validation=_baseline_alias_validation,
arm_suffix=arm_suffix,
)

baseline_aliases_prevalidated = False
Expand Down Expand Up @@ -4857,6 +4896,7 @@ def stage_native_harbor_tasks(
task_resources=task_resources,
agent_workdir=agent_workdir,
baseline_aliases_prevalidated=baseline_aliases_prevalidated,
arm_suffix=arm_suffix,
)
relative_tasks = [task.relative_to(private_output) for task in private_tasks]
if output_requires_provenance:
Expand Down Expand Up @@ -4915,6 +4955,7 @@ def _generate_harbor_tasks_into(
task_resources: dict[str, int] | None = None,
agent_workdir: str | None = None,
baseline_aliases_prevalidated: bool = False,
arm_suffix: str = "",
) -> list[Path]:
"""Generate Harbor task directories inside a private output directory.

Expand Down Expand Up @@ -4947,6 +4988,8 @@ def _generate_harbor_tasks_into(
Returns:
List of generated task directory paths.
"""
if not isinstance(arm_suffix, str):
raise TypeError("arm_suffix must be a string before generating Harbor tasks")
_validate_runtime_discovery_env(runtime_env)
_validate_runtime_loader_env(runtime_env)
agent_workdir = _validated_agent_workdir(agent_workdir)
Expand Down Expand Up @@ -5011,6 +5054,7 @@ def _generate_harbor_tasks_into(
pre_agent_setup=pre_agent_setup,
task_resources=task_resources,
agent_workdir=agent_workdir,
arm_suffix=arm_suffix,
)
_copy_verifier(task_dir)
custom_grader = _copy_custom_grader(task_dir, skill_path, grading_mode, evals_dir=evals_dir)
Expand Down Expand Up @@ -5446,9 +5490,13 @@ def generate_harbor_tasks(
agent_workdir: str | None = None,
evaluator_skill_path: Path | None = None,
_baseline_alias_validation: _BaselineAliasValidation | None = None,
arm_suffix: str = "",
) -> list[Path]:
"""Generate tasks from one private evals snapshot, then publish exactly."""

if not isinstance(arm_suffix, str):
raise TypeError("arm_suffix must be a string before generating Harbor tasks")

if evaluator_skill_path is None:
if find_evals_file(skill_path) is None:
raise FileNotFoundError(f"No evals dataset found in {skill_path / 'evals'}")
Expand All @@ -5472,6 +5520,7 @@ def generate_harbor_tasks(
agent_workdir=agent_workdir,
evaluator_skill_path=private_skill_path,
_baseline_alias_validation=_baseline_alias_validation,
arm_suffix=arm_suffix,
)
if find_evals_file(evaluator_skill_path) is None:
raise FileNotFoundError(f"No evals dataset found in {evaluator_skill_path / 'evals'}")
Expand Down Expand Up @@ -5540,6 +5589,7 @@ def generate_harbor_tasks(
task_resources=task_resources,
agent_workdir=agent_workdir,
baseline_aliases_prevalidated=baseline_aliases_prevalidated,
arm_suffix=arm_suffix,
)
relative_tasks = [task.relative_to(private_output) for task in private_tasks]
if output_requires_provenance:
Expand Down
42 changes: 33 additions & 9 deletions src/skillevaluator/tier3/harbor/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,19 +1848,43 @@ def _strip_attempt_suffix(value: str) -> str:
return re.sub(r"(?:[-_])attempt\d+$", "", value)


def _strip_arm_suffix(value: str) -> str:
"""Remove SkillEvaluator dual-arm suffixes (-with-skill, -without-skill) from an identifier."""
return re.sub(r"-(?:with|without)-skill$", "", value)


def _strip_arm_and_attempt_suffixes(value: str) -> str:
"""Remove dual-arm and attempt suffixes regardless of ordering."""
pass1 = _strip_arm_suffix(_strip_attempt_suffix(value))
return _strip_attempt_suffix(_strip_arm_suffix(pass1))


def _canonical_case_id(value: str, expected_case_ids: set[str] | None = None) -> str:
"""Normalize a task, trial, or entry identifier to its canonical case ID."""
value = str(value or "").strip()
if not value:
return ""
if expected_case_ids and value in expected_case_ids:
return value
stripped = _strip_attempt_suffix(value)
if expected_case_ids and stripped in expected_case_ids:
return stripped
generated_prefix_stripped = stripped.removeprefix("skillevaluator-")
if expected_case_ids and generated_prefix_stripped in expected_case_ids:
return generated_prefix_stripped
return stripped
name_part = value.rpartition("/")[2] or value

raw_candidates = [
name_part,
_strip_attempt_suffix(name_part),
_strip_arm_suffix(name_part),
_strip_arm_and_attempt_suffixes(name_part),
]
candidates: list[str] = []
seen: set[str] = set()
for candidate in raw_candidates + [c.removeprefix("skillevaluator-") for c in raw_candidates]:
if candidate and candidate not in seen:
seen.add(candidate)
candidates.append(candidate)

if expected_case_ids:
for candidate in candidates:
if candidate in expected_case_ids:
return candidate

return _strip_arm_and_attempt_suffixes(name_part.removeprefix("skillevaluator-"))
Comment thread
rng1995 marked this conversation as resolved.
Resolved


def _entry_id(reward: dict[str, Any], expected_case_ids: set[str] | None = None) -> str:
Expand Down
5 changes: 5 additions & 0 deletions src/skillevaluator/tier3/harbor/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,9 @@ def _persist_pre_execution_failure(errors: list[str]) -> dict[str, Any]:
)
staging_failure_stage = "with-skill-tasks"
try:
is_dual_arm = not skip_baseline
with_arm_suffix = "-with-skill" if is_dual_arm else ""
without_arm_suffix = "-without-skill" if is_dual_arm else ""
for agent in agents:
with_dir = tasks_dir / agent / "with"
without_dir = None if skip_baseline else tasks_dir / agent / "without"
Expand All @@ -2359,6 +2362,7 @@ def _persist_pre_execution_failure(errors: list[str]) -> dict[str, Any]:
task_resources=resource_config,
agent_workdir=harbor_config.get("agent_workdir"),
evaluator_skill_path=evaluator_skill_path,
arm_suffix=with_arm_suffix,
)
task_names = [task.name for task in task_paths]
if expected_task_names is None:
Expand Down Expand Up @@ -2400,6 +2404,7 @@ def _persist_pre_execution_failure(errors: list[str]) -> dict[str, Any]:
agent_workdir=harbor_config.get("agent_workdir"),
evaluator_skill_path=evaluator_skill_path,
_baseline_alias_validation=baseline_alias_validation,
arm_suffix=without_arm_suffix,
)
if not skip_baseline:
reporter.emit(ProgressEvent(stage="baseline-tasks", state="ready", detail="baseline inputs staged"))
Expand Down
Loading
Loading