Skip to content

test(conformance): add outcome-ladder scenarios - #5873

Draft
yaoyu-33 wants to merge 4 commits into
feat/agent-outcome-ladderfrom
test/conformance-outcome-scenarios
Draft

yaoyu-33 wants to merge 4 commits into
feat/agent-outcome-ladderfrom
test/conformance-outcome-scenarios

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Harness conformance scenarios for the shared outcome ladder (#5870). Stacked on feat/agent-outcome-ladder, so the diff shows only the conformance changes.

Each new scenario states the response the ladder reports for the run (Scenario.outcomes) and the Environment Server's action on it: verify (a graded rollout in rollouts.jsonl), retry (a failure row with _ng_failure_terminal: false) or fail (_ng_failure_terminal: true).

Scenario Scripted provider (Chat and Responses) P0: the ladder's outcome → action P1 target
context_overflow One shell call, then every request gets vllm_model's propagated context-length 400 (invalid_request_error, code: context_length_exceeded, no Retry-After) incomplete → verify, or failed + model_request_error 400 → verify incomplete
context_overflow_length One shell call, then every request gets vllm_model's default empty completion: Chat finish_reason: length, zero usage; Responses incomplete / max_output_tokens with nemo_gym_context_window_exceeded (checked against VLLMConverter) incomplete → verify, or completed → verify —
deadline_before_reply No answer; the request is held until the harness disconnects. 20 s harness run deadline incomplete → verify, or (transitional retry_deadline_before_reply) failed + unknown → retry incomplete
deadline_after_reply One shell call, then no answer; 20 s run deadline incomplete → verify —
harness_no_result The shell call SIGKILLs the supervised harness tree (see below) failed + agent_run_error → retry —
model_401 Every request 401 failed + model_request_rejected → fail —
model_503 Every request 503; 45 s run deadline failed + model_request_error 503 → retry, and the agent replies within 30 s of its first model request —

model_error keeps the definition #5870 gave it.

New checks

  • outcome.http_ok (P0): the agent answers the Environment Server's /v1/responses with HTTP 200, never a 5xx. The runner wraps the agent app to witness the status (witness.json → agent_replies).
  • outcome.ladder (P0): the response's status and exact ng_agent_outcome match one of the scenario's outcomes. A completed or incomplete response must carry no ng_agent_outcome (this flags a stale model_context_limit left on an incomplete response).
  • outcome.disposition (P0): the Environment Server took that outcome's action, read from the graded record or the failure row's _ng_failure_terminal.
  • model.retries_bounded (P0, model_503): decision 6's bounded harness retries.
  • outcome.target (P1): the ladder's report once its transitional rules are gone.

Checks that cannot apply now report not_applicable: model.finished and verifier.answer when the script never gives the final answer, verifier.* and the artifact verifier scope when the Environment Server did not grade the run, and tools.executed / tools.witness_* when the tool call kills the harness.

Runner changes

  • episode.DEADLINE_KEYS maps each adapter's run-deadline key (verified against each config class, and a unit test reads the annotations): timeout (int) for OpenCode, Pi, Codex, Kilo Code and OpenClaw; sandbox_runner_timeout_seconds for Hermes, Stirrup and NOOA. A scenario's run_deadline_seconds sets it; otherwise it is the probe --timeout. Codex, Kilo Code, Hermes and Stirrup used their adapter defaults before (600 s to 6 h).
  • harness_no_result's tool call walks up from its shell to the outermost ancestor carrying the supervisor's NEMO_GYM_SUPERVISOR=<identity> marker, kills those ancestors, then every other process with that identity (one grep -lz scan), then itself. The supervisor is marked detached, so it survives and reports the harness's exit. Checked on a Linux host: harness and its helper gone, supervisor alive, no marked process left; without a supervised ancestor it exits 97 and kills nothing.
  • A run that ends in a failure row is a measurement, not an execution error, in the scenarios that allow an ungraded outcome and in model_error. Collection raises IncompleteEvaluationError for such an episode; under feat(agent): add the shared outcome ladder for harness runs #5870 model_error (model_request_rejected → fail) would otherwise turn into a runner execution error once adapters migrate.
  • registry.LACKS: Simple Agent runs inside the Gym agent server, with no run deadline and no harness process, so it skips deadline_before_reply, deadline_after_reply and harness_no_result. The summary lists them under skipped_scenarios; ci_table and table expect each harness's own scenario list.
  • model_checks now compares an incomplete Responses reply by its incomplete_details.reason, which is what capture records as the call's finish reason.

Why

Plan step 1, PR "1E": every registered harness must run these events through the same ladder, and the adapter-migration PRs need an A/B measurement of today's behavior against the ladder's. No separate issue: this is the conformance part of the outcome-ladder work in #5870.

Calibration from the smoke matrix

The smoke matrix below found P0 checks that failed for every harness, the same on both sides. These were wrong expectations, not adapter bugs, and 90a4af722c corrects them:

  • deadline_before_reply and deadline_after_reply expect rollout_ended_on_failed_model_call to be unhealthy (DEADLINE_HEALTH). The held request's capture has no status, no response and error_category: cancelled, and it is the chain's last call.
  • steps.attempt_accounting (checker.py) let only HTTP errors (status 400 or above) go without a step. A request cut before any reply (no status, no response, an error category) is now a failed attempt too. This is the same shape calls.response already accepts. It failed in all 16 deadline_after_reply runs.
  • harness_no_result expects rollout_token_count_mismatch to be unobserved: the failure row has no response, so there is no usage to compare.
  • model_error uses FAILED_MODEL_HEALTH, like model_401. A harness that passes model.terminal_error reports model_request_rejected, which leaves a terminal failure row with no usage. An adapter not yet migrated (Simple Agent included) fails this check alongside model.terminal_error.

Validation

  • pytest scripts/harness_conformance/tests tests/unit_tests/rollouts/harness_capabilities tests/unit_tests/agents/test_outcome_ladder.py: 584 passed, 15 skipped (macOS; the Linux kill test is skipped there).
  • tests/unit_tests/test_import_linter_coverage.py, test_public_api_facades.py, tooling/test_migrate_imports.py, test_fern_docs_links.py: 941 passed.
  • Calibration (90a4af722c): 10 new or changed tests, all failing on the previous head. test_focused_checks.py, test_health.py, test_outcome_scenarios.py and test_behavior.py: 190 passed. Related suites: 1,383 passed. All 138 saved smoke episodes were re-checked with the new code. Only the targeted checks changed, and they now pass on every harness that reports the ladder's outcome.
  • pre-commit run --files <touched>: passed.
  • Kill command on a Linux host with a dependency-free shell harness: supervised tree killed, supervisor alive, unsupervised exit 97.
  • Full suite on Simple Agent (macOS, in-process):
Scenario HTTP Status / ng_agent_outcome Environment Server P0
model_error 200 failed / model_request_error 400 verify ✗ (expects model_request_rejected; adapter not migrated)
context_overflow 200 failed / model_request_error 400 verify ✓ (P1 incomplete ✗)
context_overflow_length 200 incomplete / — verify ✓
model_401 200 failed / model_request_error 401 fail ✗ (expects model_request_rejected)
model_503 200 failed / model_request_error 503 retry (3 attempts, 1.5 s) ✓

All other scenarios pass P0 as before; the three deadline/kill scenarios are skipped.

Smoke evidence

Scripted-model smoke on a Linux host, with no real model. All 9 registered harnesses ran the 8 scenarios on two sides:

That is 138 episodes, plus 6 skips: Simple Agent lacks the deadline and kill scenarios. No episode had an execution error or a witness violation.

What the scenarios caught on B, now fixed or reported in the adapter PRs:

After the calibration, a rerun on the same host gave:

  • Pi on this head: both deadline scenarios pass every P0 check. harness_no_result passes the token check but still fails the outcome checks, because Pi's adapter on this branch answers 500.
  • Pi on the migrated B tree: all four calibrated scenarios pass P0.
  • Simple Agent: model_error fails model.terminal_error and the token check, because no PR migrates Simple Agent yet.

Final heads (B′): this head (90a4af722c) with the four adapter PRs at their final heads merged on top (no conflicts). This run reran only the rows the fixes changed:

  • Codex, Hermes, Stirrup and NOOA context_overflow;
  • Hermes, Stirrup and NOOA harness_no_result and deadline_after_reply;
  • Pi's two deadline scenarios, harness_no_result and model_error.

13 of the 14 cells pass every P0 check. The calibrated deadline health checks and steps.attempt_accounting pass on every deadline cell. The exception is Stirrup's harness_no_result: its outcome is right (200 failed agent_run_error, retried), but the trajectory checks fail because Stirrup's runner reports its observations only in the output file a killed run never writes.

Harness-specific results this PR leaves alone:

  • Kilo Code, NOOA and Stirrup: token count unobserved on deadline_before_reply.
  • Codex: token mismatch on deadline_after_reply, and health on context_overflow_length (7 empty length stops).
  • Kilo Code: steps.accounting_gap on harness_no_result.

Compatibility

Conformance tooling only. The non-blocking harness conformance check will show the new scenarios failing for adapters that do not report through the ladder yet; the adapter-migration PRs stacked on #5870 are expected to turn them green.

🤖 Generated with Claude Code

Add seven harness conformance scenarios that state the response the outcome
ladder reports for each run and the Environment Server's action on it:
context_overflow (vllm_model's propagated context-length 400),
context_overflow_length (vllm_model's default empty length stop),
deadline_before_reply, deadline_after_reply, harness_no_result (the tool call
kills the supervised harness), model_401 and model_503.

New checks: outcome.http_ok, outcome.ladder, outcome.disposition,
model.retries_bounded (P0) and outcome.target (P1). Checks that cannot apply
(final answer, verifier evidence of an ungraded run, tool results of a killed
harness) report not_applicable.

The runner maps each adapter's run-deadline key, holds a never-answered
request until the harness disconnects, witnesses the agent's HTTP status, and
treats a failure row as a measurement where the scenario allows the run to go
ungraded. Simple Agent skips the scenarios that need a run deadline or a
harness process.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

A scripted-model smoke over every registered harness found checks that
failed identically on every harness, before and after the adapter
migrations, so the expectations were wrong rather than the adapters.

- deadline_before_reply, deadline_after_reply: the run deadline cancels
  the held model request, so the run ends on a failed model call;
  rollout_ended_on_failed_model_call is expected unhealthy.
- deadline_after_reply: steps.attempt_accounting treated the cancelled
  request as a policy response that needs a step. A request cut before
  any reply (no status, no response, an error category) is a failed
  attempt like an HTTP error, so it may stay unbound.
- harness_no_result: the Environment Server keeps a failure row for the
  retried run, which has no response usage, so
  rollout_token_count_mismatch is expected unobserved.
- model_error: the ladder reports the 400 as model_request_rejected, which
  the Environment Server fails, so it takes model_401's health
  expectations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior ci CI, automation, test queue, or workflow infrastructure work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants