Repository navigation
Conversation
…ladder Each of the three CLI adapters decided its own response status and chose between a 200, a 500 and a 502. Their sandbox sessions now fill a RunEvidence from their own records and return finish_response(...) with HTTP 200; only lifecycle failures stay typed 5xx raises. Claude Code: parse_stream_json records whether the policy model replied and the HTTP status of the "API Error: <status>" message the run ended on (Claude Code 2.1.108's own message, which the is_error result repeats); classify_outcome turns it into model_request_error. A refusal is graded as completed, a nonzero exit or missing result is agent_run_error, another error result is unknown, error_max_turns is incomplete. The classifier follows the approach of draft PR 5807. Codex: the forwarder's attempt record stays evidence. A timed-out run whose last forwarded model attempt failed to connect, was cut short, or answered 408, 425, 429 or a 5xx carries that fault as infra_fault, so it is retried; any other deadline is graded (it was a 502 when a turn had failed). A run without a usable result is agent_run_error (was 502); a supervisor error is a typed harness failure. verify_after_agent_error now marks the run as having a result, so a graded agent error is completed instead of failed without a kind. The report_rollout_stop and report_outcome calls are replaced by finish_response. OpenCode: classify_opencode_run fills RunEvidence; model_replied is whether a saved assistant turn finished without an error (the idea of PR 5798). A deadline before any assistant message keeps its retry (retry_deadline_before_reply). A deadline after a reply is graded unless the last recorded model error names an unavailable endpoint. No usable result is agent_run_error (was 502); required MCP tools that did not start, an unreadable export and a supervisor error are typed harness failures (were 502). The OOM response goes through the ladder. A 4xx other than 408, 425 and 429 before any model reply is model_request_rejected for all three. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…refactor/outcome-ladder-claude-codex-opencode Signed-off-by: yaoyu-33 <[email protected]>
…-claude-codex-opencode Keeps this branch's module-level imports in the Codex outcome tests over the base's interim per-test import fix. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE — four outcome-classification risks and missing smoke-rollout evidence.
The inline findings cover Codex's attempt evidence and OpenCode's deadline classification and required-tool checks. I inspected all 20 changed files and traced the affected paths through response finalization and the Environment Server's grading/retry policy.
RISK — Provide representative smoke evidence for all three runtimes
The PR explicitly leaves smoke validation pending. The trusted AGENTS.md requires representative model rollouts for behavior-changing agent work; mocked unit tests don't establish the native event shapes on which these new grading decisions depend. In particular, Claude's tests construct the synthetic error frames themselves (fixture), while the description says that shape hasn't been verified against the pinned binary.
Could you run each pinned runtime through a representative task with model and tool work, inspect the verifier result, and attach the commands, versions and retained artifacts? Add controlled first-request rejection and deadline cases to validate the changed dispositions. Acceptance should show: successful tool work remains completed and verified; an initial nonretryable 4xx becomes model_request_rejected without verification or retry; a deadline with no terminal endpoint fault remains gradable under the adapter's documented exceptions; and a recorded terminal 503 remains retryable for Codex/OpenCode. Preserve partial output and confirm required-tool initialization and cleanup in those artifacts. For Claude, retain the native assistant/result records demonstrating the status-text association rather than only a reconstructed fixture. This is a validation request, not a claim that those runtime cases fail.
I couldn't execute tests or model rollouts in this read-only review. The PR's reported test results and baseline-failure attribution weren't independently verified. All regression checks below are proposed checks based on inspected source.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| """ | ||
| if not attempts: | ||
| return None | ||
| last = attempts[-1] |
There was a problem hiding this comment.
RISK — An in-flight retry leaves the previous endpoint fault selected.
Have the forwarder receive a 429, finish its retry delay, and start another request that remains in flight until the supervisor deadline. The second request leaves no record, so attempts[-1] is still the 429. _deadline_model_fault supplies infra_fault, and the response becomes failed/RETRY instead of the documented incomplete/VERIFY for a final in-flight attempt. The producer records failures or finished responses, but not attempt starts. The new consumer therefore cannot distinguish a terminal failure from a stale failure preceding a pending retry. This affects timed-out Codex episodes after a transient endpoint failure.
Could you retain start/completion evidence for the latest actual attempt in forward, carry it through artifact collection, and make _deadline_model_fault return no fault when that latest attempt remains in flight? Preserve the completed-attempt records used by classify_outcome, usage handling and compaction association. Don't append an ordinary status: null start record: existing consumers interpret that as a connection failure. The representation needs a coordinated producer/consumer change; a consumer-only patch cannot recover the missing distinction.
Proposed acceptance: use an upstream that returns 429 with Retry-After: 0, then holds the retry open. At the run deadline, expect HTTP 200, incomplete, no ng_agent_outcome, policy VERIFY and matching invocation status. Retain the existing deadline cases: a terminal completed 429/503 or transport failure → failed/RETRY; [503, 200] → incomplete/VERIFY. Also retain an in-flight first request → incomplete/VERIFY and verify that compaction records still associate correctly. These checks haven't been executed.
| has_result=error is None, | ||
| timed_out=timed_out, | ||
| model_replied=any(_is_model_output(event) for _, event in events) | ||
| or any(attempt.get("status") == 200 and "transport_error" not in attempt for attempt in attempts), |
There was a problem hiding this comment.
RISK — A cancelled HTTP 200 stream is counted as a model reply.
This predicate assumes every recorded 200 without transport_error represents a whole reply. However, relay deliberately returns null when Codex cancels the stream. The existing hang-up test expects [{"status": 200}] even when Codex disconnects before the upstream response starts. If that attempt is followed by a reported 400 with no model-output events, the new predicate sets model_replied=True; the ladder verifies model_request_error:400 instead of returning model_request_rejected/FAIL.
Could you return downstream cancellation separately from successful body delivery in relay, persist a distinct cancellation marker in forward, and exclude cancelled attempts from this predicate? For example, if the marker is cancelled, replace the forwarder-based term here with:
or any(
attempt.get("status") == 200
and "transport_error" not in attempt
and not attempt.get("cancelled")
for attempt in attempts
)That consumer change requires the producer marker too. Keep downstream cancellation distinct from an upstream transport failure; treating cancellation as transport_error would incorrectly retry model-owned deadlines. Only fully delivered responses should supply this reply evidence or completed compaction evidence. Verify the suggestion before adopting it.
Proposed acceptance: extend the hang-up test to assert the cancellation marker, then add a session with cancelled-200 → 400 and no output events; expect model_request_rejected/FAIL. Preserve complete-200 → 400 as model_request_error:400/VERIFY, upstream-truncated 200 as model_transport_error/RETRY, and a deadline after downstream cancellation without an endpoint fault as incomplete/VERIFY. These checks haven't been executed.
| @@ -1804,14 +1845,15 @@ async def _session_response( | |||
| if ( | |||
| mcp_unconfirmed | |||
| and not (error or failure or reported_error) | |||
There was a problem hiding this comment.
RISK — Recheck required tools when an errored deadline becomes gradable.
Seed a required task_tools grant, leave mcp-status.json as null, use rejected_events(after_work=True) with a final HTTP 400, and set timed_out=True, return_code=-9. Here outcome.error makes error truthy, so MCP confirmation is skipped. The new evidence branch then turns that deadline into incomplete, which the default policy verifies despite the unconfirmed required tools. The base returned 502 for this combination. This changes an ungradable MCP session into scored work without restoring the required-tool guarantee.
Could you construct the final evidence before this guard and preserve an earlier error only when it still prevents grading? Apply finish_response's rollout-stop normalization before deciding eligibility, so a stopped run isn't mistaken for a retryable infrastructure deadline:
if state.session.expired and evidence.timed_out:
evidence = replace(evidence, stopped=True)
if (
mcp_unconfirmed
and not (failure or reported_error)
and (model_called or evidence.has_result)
and (not error or decide_outcome(evidence).status != "failed")
):
error = lifecycle_error = mcp_unconfirmedMove the existing reported-error/deadline evidence construction above this block. The invariant is that the new timeout policy must not bypass required-tool confirmation for work it newly makes gradable. Retain the existing reported-provider-error exemptions and deadlines without model work. Verify the suggested code before adopting it.
Proposed acceptance: extend the MCP regressions with the setup above; expect a typed HTTP 500 harness failure naming unconfirmed tools. Preserve completed model work with missing status → 500; empty-placeholder timeout → incomplete; no-assistant timeout → failed unknown; recorded-503 timeout → failed model_request_error 503; non-timeout unclassified model error → failed agent_run_error. A rollout stop with model work and missing required-tool confirmation must also fail closed. These checks haven't been executed.
| if continuation and timed_out and (event := opencode_error_event(stdout)) is not None: | ||
| error = error or f"OpenCode emitted an error event: {event}" | ||
| recorded_error = {"error": message["info"]["error"]} | ||
| if continuation and timed_out and (event := _first_error_event(stdout)) is not None: |
There was a problem hiding this comment.
RISK — The new deadline classifier reads the first error instead of the last.
For a timed-out continuation with a saved assistant message, supply two JSONL error events: {"type":"error","error":{"name":"APIError","data":{"statusCode":400}}} followed by the same shape with status 503. This assignment uses _first_error_event, so recorded_error becomes 400. Deadline attribution consequently finds no endpoint fault and returns gradable incomplete, despite the last recorded error being retryable 503. Reversing the sequence wrongly retains the earlier 503. Previously either sequence failed the activation; the new status-sensitive decision makes event ordering material.
Could you select the last explicit error event? Rename the private helper and its caller to _last_error_event, update the docstring, and replace the helper's iteration with:
for line in reversed(stdout.splitlines()):Keep the existing JSON parsing and event-shape guards, and retain the saved-assistant-error fallback when no usable error event exists. This restores the stated contract that deadline attribution uses the model error recorded last without changing single-error or error-free checkpoint behavior. Verify the suggestion before adopting it.
Proposed acceptance: extend the continuation deadline test: 400→503 must return failed model_request_error 503/RETRY; 503→400 must return incomplete/VERIFY. Retain single-503 failure, single-400 graded deadline, malformed-line handling, bare-error behavior and an error-free resumable checkpoint. This is a static counterexample in the accepted log format, not an executed test or a claim that a captured native run emitted this sequence.
…ladder decides Claude Code 2.1.108 prefixes a 401's "API Error: 401 ..." text with "Failed to authenticate. ", so the start-anchored status match missed it and the run was failed `unknown` (retried) instead of `model_request_rejected`. The parser now finds the status anywhere in the terminal error text, which is already restricted to Claude Code's own error message that the is_error result repeats. A context overflow the model server propagates reaches Claude Code as an HTTP 400 whose raw JSON body keeps the OpenAI code `context_length_exceeded`. The parser keeps that code as `api_error_code`, and `classify_outcome` reports it as `model_context_limit`, so the ladder answers `incomplete` and the run is graded, before or after the first reply (decision 1). It was `model_request_rejected` on the first request and `model_request_error` 400 after a reply. The fixtures use the exact texts from a scripted-model smoke of 2.1.108 through Gym's vLLM model server. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…-claude-codex-opencode Signed-off-by: yaoyu-33 <[email protected]>
Both adapters now classify a failed model request with the shared `model_http_error_outcome`, so a 400 whose body is the model server's context-overflow envelope (code `context_length_exceeded`) is `model_context_limit`: `incomplete` and graded, before or after the first reply (decision 1). - Claude Code keeps the body it printed after the status (`api_error_body`) in place of its own code parser. - Codex passes its `turn.failed` message, which is the endpoint's body. A scripted-model smoke showed Codex reporting the overflow as `model_request_error` 400, and the first request would have been `model_request_rejected`. Its incomplete response no longer carries the reported error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 1924564 |
…e row The outcome ladder reports a 4xx before any model reply as model_request_rejected, which the Environment Server fails instead of grading. The episode then ends as a failure row whose failed response is `_ng_failure_partial_response`, so `rollout_token_count_mismatch` found no transcript usage and reported the harness-conformance `model_error` scenario as unobserved instead of healthy. Read the partial response when the row has no `response`, as rollout recovery already does. The terminal-error behavior check no longer imports MODEL_REQUEST_ERROR, so serve that name at its old module path through MOVED_NAMES. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…t side of the ladder Codex: - The forwarder records each upstream attempt's start as well as its result. A deadline is an endpoint fault only when every started attempt finished and the last one failed; a retry still in flight (after a 429 wait, or Codex's own retry of a 503) leaves the deadline graded. - A 200 that Codex hung up on before it arrived is recorded as cancelled and no longer counts as a model reply, so a 400 that follows is a rejected first request. A cancelled stream gives no compaction evidence. OpenCode: - A timed-out continuation records the last error event, not the first. - The required-tool check runs on every run the ladder would grade, including a deadline after a reply that recorded a non-endpoint error; an expired session is counted as stopped before the status is decided, as finish_response does. - Cover a deadline whose last model call failed without a status. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…usage Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
A stalled or broken reply that Codex hangs up on is recorded as a cancelled 200. When Codex reported that endpoint failure after its last model output and no retry had started before the deadline, the deadline was spent on the endpoint: report it as a transport fault, retried, as the base's 502 was. A hang-up without a reported failure (the deadline killing Codex mid-reply) stays graded. Also correct the Codex README's missing-image outcome (a typed 500, not 502) and note in the OpenCode README that an outage OpenCode keeps retrying until the deadline is graded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
… after A healthy retry that the deadline kills is also recorded as a cancelled 200, and Codex's earlier "Reconnecting" notice is then still its last event. Time each attempt's start on the sandbox clock that stamps the CLI events, and count a reported stream failure against the cancelled last attempt only when the runner saw it after that attempt started. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
On the outcome ladder, a Codex run that died while its sandbox still runs (verify_after_agent_error) is completed or incomplete with `graded_agent_error` in its metadata, not failed. Read that marker so TB4 still records the Harbor-parity `nonzero_exit` termination, and the resume rule does not reuse the attempt as a normal finish. Update the TB-science README for a first-request rejection, now failed ungraded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test c3dfcda |
…e row This PR reports a 4xx before any model reply as model_request_rejected, which the Environment Server fails instead of grading. The episode then ends as a failure row whose failed response is `_ng_failure_partial_response`, so `rollout_token_count_mismatch` found no transcript usage and the Hermes and Stirrup conformance `model_error` scenarios reported it unobserved instead of healthy (P0). Read the partial response when the row has no `response`, as rollout recovery already does. Same change as b9249e3 on #5877 (its health-check part), so the two branches merge cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
verify_after_agent_error no longer turns a Codex run that died while its sandbox still runs into a completed response. The run stays failed with agent_run_error, like any run that leaves no usable result, and the Environment Server's outcome policy decides whether it is graded. The flag now only labels the run (metadata.graded_agent_error) after the liveness probe, and keeps the usage of its unfinished turn. Terminal-Bench-Science's Codex profile, the config that sets the flag, maps agent_run_error to verify in its environment server, so those runs are graded as Harbor grades them; ++tbsci_agent_run_error_action=retry retries them. TB4 again reads the failed status as its nonzero_exit termination, so the graded_agent_error branch from the previous commit is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test eb43d5d |
Stacks on #5870 (the shared outcome ladder). The base branch is
feat/agent-outcome-ladder, so this diff shows only the three adapters. Retarget tomainafter #5870 merges.What and why
Claude Code, Codex and OpenCode each decided their own response status and chose between HTTP 200, 500 and 502 for the same event. Their sandbox sessions now fill a
RunEvidencefrom their own records and returnfinish_response(...)with HTTP 200. Only lifecycle failures stay typed 5xx raises (NgFailureEvent(boundary="harness", failure_kind="agent_route_failed")): a supervisor error, an unreadable export, required MCP tools that did not start. No adapter raises a bare 502 any more.All three now report a 4xx other than 408, 425 and 429 before any model reply as
model_request_rejected(decision 4).Claude Code (
parsing.py,app.py)parse_stream_jsonrecordsmodel_replied(any assistant message that is not Claude Code's own<synthetic>error message, subagents included) andapi_error_status. The status comes from theAPI Error: <status> <body>message the run ended on, and only when theis_errorresult repeats that text.classify_outcometurns that status intomodel_request_errorthrough the sharedmodel_http_error_outcome, which reports a 400 whose body is the model server's context-overflow envelope (codecontext_length_exceeded) asmodel_context_limit. The status is found anywhere in the error text: Claude Code 2.1.108 prefixes a 401 with "Failed to authenticate. ". It reuses the classifier approach of draft PR fix(claude): retain helper and failed-call evidence #5807 (root synthetic message plus matching result), but not that PR's rule that refusals and process exits reportunknown._run_evidence:completedand graded (decision 5);error_max_turnsisincomplete;unknown;agent_run_error._invocation_outcomebecomesinvocation_error_type, which keeps the observations' own labels (process_exit_N,refusal, ...). The local host path's response is unchanged: it still returns no status, and only its observation status follows the ladder.error.message.Codex (
app.py)model_attempts.jsonl) stays evidence. It records each attempt's start as well as its result. A whole 200 reply counts as a model reply; a 200 that Codex hung up on before it arrived is recordedcancelledand does not.infra_faultwhen the last recorded forwarded attempt failed to connect (status: null), was cut short (transport_error), or answered 408, 425, 429 or a 5xx. The run is thenfailedwith that kind and retried. An attempt still in flight at the deadline (a start without a result, such as the retry after a 429) and a failure that a later attempt recovered from leave the deadline to the model, so the run is graded. A last attempt Codex hung up on is a transport fault only when Codex reported an endpoint failure after its last model output (a stalled or broken stream) and the runner saw that report after the attempt started (start records carry the sandbox clock that stamps the CLI events). This replaces the 502 that any failed turn caused.classify_outcomepasses theturn.failedmessage, which is the endpoint's body, tomodel_http_error_outcome, so a propagated context overflow is a gradedincompletecontext limit. An incomplete response no longer carries the reported error.agent_run_error(was 502). A supervisor error in the receipt is a typed harness failure (was 502).verify_after_agent_errorno longer decides the status. A run that died while its sandbox still runs isfailedwithagent_run_error, like any run without a usable result. The flag runs the liveness probe, labels the run withmetadata.graded_agent_error, and keeps the usage of its unfinished turn. Whether the run is graded is the Environment Server's outcome policy. Onmainthe run wasfailedwith no kind. See "Decision:verify_after_agent_error" below.report_rollout_stopandreport_outcomeare replaced byfinish_response. The invocation's observed status now follows the response, rollout stops included.OpenCode (
continuation.py,app.py)classify_opencode_runfillsRunEvidence:model_repliedis whether a saved assistant turn finished without an error. This follows the_ng_answered_beforeidea in PR fix: make local task-folder runs work on laptops and report rejected model requests #5798.length/content-filter→ output limit and single-turntool-calls→ turn limit.incomplete.retry_deadline_before_reply=True, only in exactly the case that was a 502). A resumable continuation checkpoint and an unfinished assistant placeholder stay graded, as before.infra_fault).agent_run_error(was 502). The OOM response and the pre-launch timeout go through the ladder.incomplete_detailsis now set for single-turn length and content-filter stops too.No separate issue: this is the adapter half of the outcome-ladder step that #5870 starts.
Disposition by event
Action = what the Environment Server does with the response under the default policy (verify = graded, retry = new episode attempt, fail = neither). Bold rows change disposition. The
maincells come from reading the adapters atacb67734cc(unchanged by #5870). The tests this PR updates pinned them, and each updated test says why.Claude Code (sandbox session)
API Error: 400after a reply (propagate flag on)agent_run_error→ retryagent_run_error→ retryevents.jsonlmodel_request_error429/5xx → retrymodel_request_rejected(before a reply) ormodel_request_error401 → failmodel_request_rejected→ failagent_error,error_during_execution)unknown→ retryerror_max_turnsCodex (sandbox session)
model_request_error400 → verifymodel_request_error400 → verifymodel_transport_error/model_request_error→ retrymodel_transport_error→ retryturn.completed)agent_run_error→ retryverify_after_agent_errorand a live sandboxagent_run_error(labeledgraded_agent_error) → retry; verify where the policy mapsagent_run_errortoverify(the TB-science profile does)agent_route_failed→ retryturn.failed, exit 1)model_request_error→ retryagent_run_error→ retrymodel_request_error401 → failmodel_request_rejected(before a reply) → failmodel_request_error400 → verifymodel_request_rejected→ failOpenCode (sandbox session)
ContextOverflowErrorunknown→ retrystopfinish, no assistant)agent_run_error→ retryagent_route_failed→ retryAPIError)model_request_error→ retrymodel_request_error401 → failmodel_request_rejected(before a reply) → failmodel_request_error→ verifymodel_request_rejected→ failreport_agent_sandbox_oom)provider_oom_killed→ verifyScore impact: Claude Code changes the most: provider errors, nonzero exits, missing results and unclassified error results were graded and are now retried, failed or rejected. Codex and OpenCode change only for a first-request 4xx and for deadlines (graded unless an endpoint fault was recorded). Codex also changes for a run
verify_after_agent_errorlabels, under the default policy only; the one profile on this branch that sets the flag keeps grading it (see the decision below). Row counts on real runs come with the smoke and A/B phase.Decision:
verify_after_agent_error(2026-11-19)A Codex run that dies while its sandbox still runs is
failedwithagent_run_error, notcompleted. This is the "no usable result" rule: no adapter flag changes a status. Harbor's grade-after-any-exit behaviour comes from the Environment Server's outcome policy. Commiteb43d5d876:app.py): a labeled run no longer getshas_result=True.verify_after_agent_errorstill runs the liveness probe, writesmetadata.graded_agent_errorand reads the unfinished turn's usage from the session transcript. It no longer changes the status. README and config comments say so.benchmarks/terminal_bench_science/codex.yaml): this is the only config on this branch that sets the flag. Its environment server getsagent_outcome_policy.by_failure_kind: {agent_run_error: ${oc.select:tbsci_agent_run_error_action,verify}}. The other kinds keep their defaults. To retry these runs instead, pass++tbsci_agent_run_error_action=retry; it replaces++tbsci_verify_after_agent_error=false, which now only drops the label and the transcript usage.failedresponse is again terminationnonzero_exit, as onmain. Thegraded_agent_errorbranch added on 2026-11-17 (c3dfcda816) is removed, along with its test rows and README line.Disposition of a Codex run under the TB-science profile:
mainagent_run_error→ verifyagent_run_error→ retryagent_run_error→ verifyagent_run_error→ retryagent_run_error→ verifyagent_run_error→ retryagent_run_error→ verifyagent_route_failed→ retryturn.failed)The labeled run, the case the profile was written for, scores as on
main. TB4 records the samenonzero_exittermination for it.Liveness probe. The probe no longer changes how a row is handled. The policy grades every
agent_run_error, so the three bold rows above are now graded wheremainretried them. Not checked here: how TB4's verifier answers when the task sandbox has stopped. The probe's split between infrastructure and agent failures now survives only as data. A graded row carriesmetadata.graded_agent_erroronly when all of these hold: Codex started a turn, its cleanup was confirmed, no endpoint error ended the run, and the probe found a live sandbox. The split can be read from the rows, but it no longer routes them. One way to keep it in routing: Codex could report the unlabeled cases with their own kinds,model_transport_errorfor an endpoint error that ended the run and aprovider_*kind for a sandbox that stopped answering. The default policy already retries those kinds, soagent_run_error: verifywould then reach only agent exits. That change is not made here.Not on this branch.
mainalso setsverify_after_agent_error: trueinenvironments/ui_generation_agentic/codex.yaml(#6012), which is not on this branch yet. When this branch next mergesmain(after #5870), that environment server (ui_generation_agentic_environment_server) needs the sameagent_run_error: verifyoverride. Without it, its failed Codex runs are retried instead of graded.Validation (Linux workstation, Python 3.13.14; imports confirmed from each tree),
c3dfcda816→eb43d5d876:responses_api_agents/codex_agent/tests: 618 passed, 6 skipped → 618 passed, 6 skipped.terminal_bench_4/tests/test_resources_sessions.pyplustest_terminal_bench_science.py: 82 passed → 82 passed. Two reverted TB4 rows were replaced by the two new profile cases.c3dfcda816's code: 8 fail, as they should. They are:codex_deepseek_flash.yaml, validates as asingle_agent_turn_legacyconfig.agent_run_errorresolves toverify, or toretrywith the knob, and the other 16 kinds keep their defaults.pre-commit run --files <changed files>: passed.single_agent_turn_legacyserver with the override, the real Codex session lifecycle, and a stubbed resources server.For review
Retry-After, which complies. OpenCode retries failed model calls inside the pinned CLI with no limit of its own, bounded only by the deadline. Claude Code's own CLI retries were not audited. Neither is changed here.Validation
pytest responses_api_agents/{claude_code_agent,codex_agent,opencode_agent}/tests(macOS, worktree onPYTHONPATH): 1495 passed, 128 skipped, 1 failed. The failure istest_opensandbox_sdk_is_available_in_agent_environment: the local venv lacks the SDK, and it fails on feat(agent): add the shared outcome ladder for harness runs #5870 too.scripts/harness_conformance/tests,tests/unit_tests/rollouts/harness_capabilitiesandtests/unit_tests/agents: 2529 passed, with 4 baseline failures (the sameopensandboxtest and threecloudpickleimports, also failing on feat(agent): add the shared outcome ladder for harness runs #5870). The OpenCode suite alone, run serially: 786 passed, 60 skipped.tests/unit_tests/test_public_api_facades.pyandtests/unit_tests/test_import_linter_coverage.py: 856 passed.claude_code_agent/tests/test_outcome_ladder.py: parser evidence; text that must not classify; one row per event through_sandbox_response, checking status, kind and policy action.opencode_agent/tests/test_outcome_ladder.py:RunEvidencefromclassify_opencode_run; one row per event through an HTTP session.test_sandbox_sessions.py: the deadline rule (_deadline_model_fault) and one row per event through an HTTP session.test_continuation.py: a continuation deadline with a 503 or a 400 error event._invocation_outcomeand first-request 400s. 25 Codex tests on feat(agent): add the shared outcome ladder for harness runs #5870's head importedagent_outcome_policyfromenvironment_servers.single_agent_turn.app, which feat(agent): add the shared outcome ladder for harness runs #5870 no longer exports. They now import fromnemo_gym.agents.pytest -n 4/-n 6on this loaded machine, an OpenCode session test occasionally fails, a different one each run. The cause is aKeyError('')in the test fake's bash-based params reader, or a timing check. feat(agent): add the shared outcome ladder for harness runs #5870 shows the same, and each test passes when re-run alone.claude_code_agent/tests: 225 → 224 passed (one classifier test folded into a table);codex_agent/testsplustests/unit_tests/agents/test_outcome_ladder.py: 555 → 616 passed, 6 skipped (2 new Codex tests, plus the ladder file in the same run).pre-commit run --files <touched files>: passed.Smoke evidence
Scripted-model smokes on a Linux host, with no real model. Gym's real
vllm_model(propagate_context_overflow_errors: true) sits in front of a scripted upstream. The Environment Server action is whatagent_response_actionreturns under the default policy.main's adapters plus the ladder core).a42db7b1fa.90cbdfdb1f, then6204710bf4).Codex and OpenCode: the harness conformance scenarios, A → B.
model_error(400 before a reply)model_request_error400 → verify ⇒ failedmodel_request_rejected→ failcontext_overflowmodel_request_error400 → verify on A and B; B′ (6204710bf4): 200 incomplete → verify,outcome.targetpassescontext_overflow_lengthdeadline_before_reply,deadline_after_replyharness_no_resultagent_run_error→ retrymodel_401model_request_error401 → fail ⇒ failedmodel_request_rejected→ failmodel_503model_request_error503 → retry, unchangedEach harness changes one disposition (
model_error). No episode had an execution error.Claude Code 2.1.108. Claude Code is not in the conformance registry, so a driver ran the session routes (seed, activation, close) against the local sandbox provider.
model_request_rejected→ failmodel_request_error400 → verifyunknown→ retrymodel_request_rejected→ failmodel_request_error503 → retrymodel_request_rejected→ failmodel_request_error400 → verifyagent_run_error→ retryCounts: A verify 9; B′ verify 5, retry 2, fail 2. The 401 and context rows of B are what the fixes in this PR correct. The test fixtures now use the exact 2.1.108 texts from this smoke.
Decision 6 (harness retries), found by the smokes and not changed here:
incompleteand is graded instead of retried.Not verified here:
Stack merge and CI repair (2026-11-16)
Merged current
main(5d6429f5b1362af47954d8cf72f03cbe443ff941) into #5870 with signed merge commit94d20acf69ef5dff3c0c3616d77e1c0e09c9a7dd, then merged that base here as1924564f104e736b2846f673a64d353b29855d03. Both pushes were fast-forwards; this PR remains based onfeat/agent-outcome-ladder.Conflict resolution keeps the image-input guard from #5960, OpenCode v2 from #6001, and the step-limit marker from #5719. In particular, Codex runs that omit required prompt images still fail before grading; they now use the typed HTTP 500
agent_route_failedlifecycle path rather than the prior bare 502. The image-retention matrix checks failed observations, the typed cause, normal completion, output limits, deadlines and model errors. OpenCode v2 tests now checkRunEvidencevia the ladder and the typed required-MCP failure.Workstation validation (Python 3.13.14, source imports verified against the intended worktree):
pytest tests/unit_tests/agents/test_outcome_ladder.py tests/unit_tests/agents/test_outcome_response.py resources_servers/ui_generation/tests -q: 180 passed; scoped pre-commit passed.pytest responses_api_agents/codex_agent/tests/test_sandbox_sessions.py responses_api_agents/opencode_agent/tests/test_opencode2_session.py responses_api_agents/opencode_agent/tests/test_opencode2_store.py -q: 392 passed.94d20acf6using the same environment: 27 config tests reject installed OpenAI 2.45.0 against the 2.44.0 pin, one lacks OpenSandbox, and one workstation shell returns exit 2 rather than 126 for invalid executable bytes. Installing 2.44.0 separately also fails to import the base becausePromptCacheOptionsis absent. These baseline/dependency issues were not changed here.pre-commit run --files <all 22 PR files>andgit diff --check origin/feat/agent-outcome-ladder: passed.No new real-model rollout was run during this merge repair. The earlier scripted-model evidence above remains revision-bound; this is not a new smoke qualification. CI authorized on both new heads. The main pipeline for this head is 43998457482; completion is pending.
Review fixes and CI repair (2026-11-17)
No merge was needed: the branch already contains
feat/agent-outcome-ladderat94d20acf69. Six commits on top of1924564f10.CI causes. Five checks failed on
1924564f10. Two root causes; the others were their aggregates.Core tests (shard 1):test_every_recorded_name_still_resolves_at_its_old_path. feat(agent): add the shared outcome ladder for harness runs #5870'sbehavior.pystopped importingMODEL_REQUEST_ERROR, which the import surface records at its old path. Fixed with aMOVED_NAMESentry andmoved_names_getattrinbehavior.py(nemo_gym/_moved_paths.py,nemo_gym/rollouts/harness_capabilities/behavior.py). feat(agent): add the shared outcome ladder for harness runs #5870 fails the same test.codexandopencodeconformance probes (exit 2): themodel_errorscenario's P0 health checkrollout_token_count_mismatchwasunobserved, expectedhealthy. A rejected first request is nowmodel_request_rejected, which the Environment Server fails, so the episode ends as a failure row with noresponse._transcript_tokens(nemo_gym/rollouts/health/checks.py) now reads the failure row's_ng_failure_partial_response, as rollout recovery already does. New testtest_failure_row_accounts_tokens_from_its_partial_response;rollout-health.mdxsays so.Environment Server compliance(non-blocking): rule A1 (run()defined) on Claude Code and Codex.mainhas the samerun()methods; not changed here.Review fixes (team review with Codex cross-check; the four earlier bot findings were all still present):
sandbox_launcher.mjs,sandbox.py,app.py(_deadline_model_fault): attempt starts recorded, so a retry in flight at the deadline no longer selects the earlier 429/503; a cancelled 200 is no model reply, so a 400 after it ismodel_request_rejected; a deadline after a stream Codex gave up on (reported idle or broken stream after that attempt started, no retry started) is a transport fault and retried, as the base's 502 was; a healthy retry the deadline kills stays graded. A cancelled stream gives no compaction evidence.continuation.py: a timed-out continuation records the last error event, not the first.app.py: the required-MCP check runs on every run the ladder would grade, including a deadline after a reply with a recorded 400; an expired session counts as stopped before the status is decided, so the invocation status matches the response._termination_from_response: a response withgraded_agent_error(Codexverify_after_agent_error, thencompletedorincomplete) keeps thenonzero_exittermination it had asfailed, so the resume rule does not reuse it as a normal finish. TB4 and TB-science READMEs updated. (Removed on 2026-11-19: the run isfailedagain, see the decision above.)1924564f10.add-or-update-a-harness.mdx(stop route usesfinish_response).Validation (Linux workstation, Python 3.13.14, Node 22):
pyteston the three adapter suites,scripts/harness_conformance/tests,tests/unit_tests/rollouts,tests/unit_tests/agents,tests/unit_tests/test_moved_paths.py: 5714 passed, 29 skipped, 8 failed. The same 8 fail on1924564f10in that environment (test_tool_telemetry×4,test_outcome_policyupload evidence ×3, OpenCodetest_pinnedexit-code check).python -m scripts.run_harness_conformance: codex and opencode fulfilled, all 9 scenarios,model_errordelivered as a failure record.pre-commit run --files <changed files>: passed.Smoke: outcome classes (Codex, real pinned CLI, scripted model through the conformance provider; no real model):
tool_successcompletedretry_500(one 500, then recovery)completedverifier_failure(task failure)completedmodel_error(400 on the first request)model_request_rejected, terminalmodel_request_error503, retryable; 30 forwarded attemptsLeft for the author:
is_errorresult withoutAPI Error: <status>(for example a status-less context overflow) isunknownand retried;maingraded it. Unverified on 2.1.108's default vLLM path.main).verify_after_agent_error: decided on 2026-11-19 (failedwithagent_run_error, graded by the profile's policy). See the decision above._moved_paths.pyandbehavior.pypart ofb9249e3a68fixes a test feat(agent): add the shared outcome ladder for harness runs #5870 fails too; cherry-picking it into feat(agent): add the shared outcome ladder for harness runs #5870 lets that PR's CI pass, and the identical change then merges cleanly here.🤖 Generated with Claude Code