Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions resources_servers/terminal_bench_4/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def _verified_response(self, session, extra):
failure_kind=(
VERIFIER_ERROR
if verifier_failure or ungraded_verifier
else _agent_failure_kind(session.termination, extra, masked=not legacy)
else _agent_failure_kind(session.termination, extra)
if failure
else None
),
Expand Down Expand Up @@ -939,11 +939,11 @@ def _termination_from_response(response: NeMoGymResponse) -> AgentTermination:
return AgentTermination(reason="nonzero_exit", detail=f"Agent response status: {response.status}")


def _agent_failure_kind(termination: AgentTermination, harness_metadata: dict, *, masked: bool) -> str | None:
"""The kind of an agent infrastructure failure: the one the server typed, else the harness's, else, for a masked
result, ``infrastructure_error`` so the row is never masked without a kind."""
kind = termination.failure_kind or _selected_failure_kind(harness_metadata)
return kind or (failure_kinds.INFRASTRUCTURE_ERROR if masked else None)
def _agent_failure_kind(termination: AgentTermination, harness_metadata: dict) -> str | None:
"""The kind of an agent infrastructure failure: the one the server typed, else the harness's, else
``infrastructure_error``. A masked result and a row routed to the failures sidecar both need a kind: recovery
stops a run on a failure without one instead of retrying it."""
return termination.failure_kind or _selected_failure_kind(harness_metadata) or failure_kinds.INFRASTRUCTURE_ERROR


def _selected_failure_kind(harness_metadata: dict) -> str | None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,23 @@ def test_an_agent_infrastructure_failure_stays_one_whatever_its_verifier_did(tmp
assert verified["_ng_failure_class"] == "infrastructure_error"
assert verified["_ng_failure_type"] == "AgentInfrastructureError"
assert verified["infrastructure_error"] == "AgentInfrastructureError"
assert verified["failure_kind"] is None
assert verified["failure_kind"] == "infrastructure_error"


def test_a_sidecar_setup_failure_has_a_kind_recovery_can_retry(tmp_path):
"""A task environment that failed to start (here a Compose service) is routed to the failures sidecar; without a
kind, recovery stops the run instead of retrying the rollout."""
verified = _verified(
tmp_path,
{"exception_info": {"exception_type": "RuntimeError"}},
AgentTermination(
reason="infrastructure_error", detail="RuntimeError: Compose service 'loadgen' unhealthy: exit status 1"
),
)

assert verified["_ng_failure_class"] == "infrastructure_error"
assert verified["mask_sample"] is False
assert verified["failure_kind"] == "infrastructure_error"


@pytest.mark.parametrize("exception_type", ["TimeoutError", "RuntimeError", "VerifierStatusUnknownError"])
Expand Down
Loading