Repository navigation
fix(resources_servers): record failures scored as model results in perceptionbench, agentic_turn_simulation_judge and opencode_sandboxed_agent - #7041
Conversation
…rceptionbench, agentic_turn_simulation_judge and opencode_sandboxed_agent A re-scan of the #4883 audit found three more places where a failure is scored as a model result and nothing in the saved row says so. As in #6984, each keeps the score and mask it had and is now reported through observe_scored_despite_failure, so the rollout is no longer indistinguishable from a normally graded one. No reward, mask or retry changes. - perceptionbench: a policy response with status failed, or with an error, is recorded as model_request_error. The text it left is scored as before. A response that is incomplete (for example at max_output_tokens) is the model's own cutoff and records nothing. - agentic_turn_simulation_judge: the same record for a failed policy response, which is scored as a parse failure as before. - opencode_sandboxed_agent: a failed idle check (the run is not nudged and is graded as it stands) and a failed stuck-marker read (the run is graded without it) were only printed; each is recorded as agent_run_error. Part of #6983 (work package 1 follow-up), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
…s as results Review of the previous commit found two failures of the idle check and the stuck-marker read that come back as a result instead of an exception, so they were still indistinguishable from a healthy run. - A stuck-marker read whose exec reports an error_type (for example a timeout) and prints nothing returned None as if no marker existed. It is now recorded as agent_run_error and still returns None. - An OpenCode session export that exits non-zero stopped the idle check, so the run was not nudged and was graded as it stood. It is now recorded as agent_run_error, with the command's own failure text, and the run is graded as before. Scoring and retry behavior are unchanged. The new tests drive both paths with a sandbox that returns the failure. Part of #6983 (work package 1 follow-up), under #3180. Signed-off-by: Onur Yilmaz <[email protected]>
|
/ok to test 9fc9344 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I reviewed all six changed files with three component reviewers and traced failure observations through reply headers, saved rows and the health check. I found no score, mask or retry regression in the exercised paths. There is one required-validation gap and four nonblocking suggestions below.
RISK: real rollout evidence is missing for two components
Could you provide representative real-model smoke rollouts for PerceptionBench and OpenCode? The PR explicitly lists both as unit-test-only. Protected-base AGENTS.md requires real smoke rollouts for behavior-changing environment or agent work. These changes add externally visible failure events and health findings in the PerceptionBench verifier and OpenCode harness.
The missing evidence concerns integration, not an observed scoring defect. Please record a representative image task through the policy/judge pairing and an OpenCode task through a real sandbox, inspect their saved rows, and report rewards, masks and failure-event outcomes. Healthy runs should add no event; controlled replay or fault injection can demonstrate the failure observations without requiring a live provider outage. Preserve existing scoring and retries.
Validation
- CI for this head's merge commit
918890bc9ea9344940b1a25116a76a274f968eb5passedNemo_CICD_Test,Unit tests / Test, changed-server tests and lint. Component logs show PerceptionBench 81 passed, agentic-turn judge 218 passed, 1 skipped, and OpenCode 240 passed. The full server-shard job was skipped; changed-server tests supplied coverage. Nonblocking Environment Server compliance is red for existingrun()/agent-session warnings. - Local probes ran in
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:3f8328838dc782ffc8d8f17ef48dccbfe681ef4a, a default-branch CI image because this head had no successful image build. Base/head comparisons covered nine PerceptionBench cases, 36 judge cases, and eight marker plus six OpenCode response cases. Returned behavior matched, apart from the intended diagnostics. HTTP/header/row/health probes and 100 interleaved request scopes passed. Marker edge probes and a test-oracle mutation exposed the suggestions below. - I did not run a real model, GPU workload or remote sandbox. Initial scratch-probe import and middleware setup errors were corrected before collecting the reported results.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| """The scenario stuck_detector.mjs recorded, or None.""" | ||
| try: | ||
| res = await sandbox.exec(command=f"cat {stuck_dir}/stuck.json 2>/dev/null || true") | ||
| if res.error_type is not None: |
There was a problem hiding this comment.
NOTE, suggestion: observe unknown exit receipts too. This condition misses return_code=-1, error_type=None, stdout="". ECS can produce that shape when its reply lacks rc (source), and this adapter treats it as an unknown outcome elsewhere.
My collation/marker_probe.py returned result=null, events=0, health=0, indistinguishable from an absent marker. Could you include nonzero/unknown exit receipts in the observation without changing the returned marker, score or retry behavior? Add a case asserting one event for this shape and none for a successful empty read.
There was a problem hiding this comment.
The shell currently turns every cat error into exit 0 with || true. Using Gym’s local sandbox, I put a directory at stuck.json. A direct read exited 1, but the helper returned None with zero events, exactly as it did for a missing marker. Could you keep an absent marker quiet and record one event when an existing marker cannot be read? Checking the provider’s exit code will then catch that case too.
| failure_reason=f"Reading the stuck marker did not complete ({res.error_type}); the run is graded without it", | ||
| stage="agent", | ||
| ) | ||
| return json.loads(res.stdout).get("scenario") if (res.stdout or "").strip() else None |
There was a problem hiding this comment.
NOTE, suggestion: record one failed marker read once. With error_type="timeout" and partial stdout "{", the observation above runs, then JSON parsing raises and the catch records the same read again. Running /workspace/review-probes/venv/bin/python /workspace/review-probes/collation/marker_probe.py produced two saved events and health detail count=2 for one exec. Grading was unchanged.
Could you share or deduplicate the observation across the result-error and parse-error paths? Preserve current parsing: valid partial stdout under a timeout still returns its scenario. Acceptance cases should cover timeout with empty, malformed and valid stdout, each with one event, plus a healthy read with none.
| result, _ = await _verify_observed(server, _make_request(text, status="failed")) | ||
| assert isinstance(result, PerceptionbenchVerifyResponse) | ||
| assert result.mask_sample is False # unchanged: nothing is masked | ||
| if not text: |
There was a problem hiding this comment.
NOTE, suggestion: assert the with-text reward too. The new test checks reward only for empty text. I ran perceptionbench-1/test_oracle_probe.py, which changes the failed-with-text result from reward 1.0 to 0.0 in memory; both new parameter cases still passed. Existing healthy-response tests do not protect this failed-response-specific invariant.
Could you replace the conditional with assert result.reward == (1.0 if text else 0.0)? The unchanged implementation should pass, while that mutation should fail for with_text. This protects the PR's promise to keep grading available partial answers, without changing production behavior.
There was a problem hiding this comment.
Could you also add a response with status="completed" and a populated error? Removing or body.response.error is not None still leaves the PerceptionBench tests green. Giving that response a gradeable answer and asserting its reward plus one event with the provider’s message would cover both the error-only branch and the scoring behavior.
| def _recorded(log: RequestFailureLog) -> list: | ||
| return [e for e in log.report.events.values() if e.operation == "scored_despite_failure"] | ||
|
|
||
| @pytest.mark.parametrize("text", [None, YES[:20]], ids=["empty", "partial"]) |
There was a problem hiding this comment.
NOTE, suggestion: cover a failed response with a complete verdict. This parameterization covers only empty/truncated text. The new docstring and implementation comment describe failed responses as parse failures, but a complete valid verdict with status="failed" still returns reward 1.0, parse_ok=True and an unmasked result on both base and head. The differential probe confirmed that behavior.
Could you add YES with those concrete expected values and the same single observation, and describe the available text as scored unchanged? Empty/truncated cases should keep their existing zeros. This protects gradable output rather than changing scoring policy.
yuhezhang-ai
left a comment
There was a problem hiding this comment.
The before-and-after cases preserved the rewards and masks. I’m requesting two changes to the failure reporting before merge. An attempt can acquire a scored marker even when it never reaches grading, and a single failed response can be counted twice or attributed to the wrong cause. The inline comments include reproductions for both.
| if exported.return_code != 0: | ||
| # The idle check could not read the session, so the run is not nudged and is graded as it | ||
| # stands, as before; the failed export is recorded. | ||
| observe_scored_despite_failure( |
There was a problem hiding this comment.
Blocker — emit scored_despite_failure only after grading succeeds. I made the idle export and the mandatory final export both return nonzero. This call recorded the event, then the final export raised opencode.export. The run never called /verify.
The same timing matters in both verifiers. With a failed policy response and an unreadable judge verdict, PerceptionBench returned mask_sample=True and failure_kind=judge_failed, yet the per-row health check reported it as scored despite failure. The agentic turn simulation judge did the same on its internal scoring-error path.
Could you keep the underlying failure as a diagnostic and apply the scored marker only once the attempt returns an unmasked score? A regression test should cover both a failed final export or masked verdict with zero scored markers, and a failed response with a usable answer that keeps its reward and records one marker.
There was a problem hiding this comment.
One smaller follow-up in the same idle check. A zero-byte or whitespace-only export.json becomes {} through json.loads(local.read_text().strip() or "{}"), so the parse-error handler never runs. I reproduced zero nudges and no event when the final export subsequently succeeded and the verifier returned 1.0. Could you let an empty download take the existing parse-error path? That keeps the zero nudges and records one failure on the graded run.
| # mistaken for the model's own miss. | ||
| observe_scored_despite_failure( | ||
| boundary=FailureBoundary.RESOURCES_SERVER, | ||
| failure_kind=MODEL_REQUEST_ERROR, |
There was a problem hiding this comment.
Blocker — preserve the originating failure kind and count the response once. I ran the single-agent environment and this verifier together with one unclassified failed response containing a correct answer. It earned 1.0, but the request recorded both agent_run_error from the environment and model_request_error from here. With a response explicitly classified as provider_oom_killed, the only scored event said model_request_error.
Could you have the environment and verifier agree on which one records a given failed response, and carry through its classified cause when available? Please cover the combined path as well as direct /verify so each produces one attributed event for a graded failure.
What
A follow-up to #6984 (work package 1 of #6983, under #3180). A re-scan of the #4883 audit found three more places where a failure is scored as a model result and nothing in the saved row says so. As in #6984, no score, mask or retry changes: each case keeps what it had and is now reported through
observe_scored_despite_failure(#6393), saved beside the row as_ng_failure_eventsand counted by therollout_scored_despite_failurehealth check.perceptionbenchstatus=failed, or with anerror, is scored on whatever text it left (reward 0.0 when there is none). A response that is incomplete (for example atmax_output_tokens) is the model's own cutoff and records nothing.model_request_erroragentic_turn_simulation_judgeparse_ok=False, unmasked).model_request_erroropencode_sandboxed_agenterror_type(for example a timeout), and an OpenCode session export that exits non-zero. All four are recorded.agent_run_errorWhy
#6983 tracks failures scored as model results. Whether Gym should mask, retry or keep such a sample is an open decision (D1-D4) and affects training, so this only makes the failure visible, as #6984 does.
Not in this PR
perceptionbenchcontext-window overflow (MODEL_CONTEXT_LIMIT, scored 0): model-side by its kind.perceptionbenchandagentic_turn_simulation_judgeresponses that are incomplete for a provider-side reason such ascontent_filter: whether that is the model's result is a D1 question.swe_gym,r2e_gymandscale_swe: the code documents a timed-out test as the model's zero (fix(deepswe): score tests that hit their time limit as unresolved #6198).stem_judgeMath-VerifyOSErrorfallback to the judge: the row is still validly judged.Compatibility
Scores, masks and retries are unchanged, so benchmark results and training data do not move. A row that hit one of these cases gains a
_ng_failure_eventsentry, and therollout_scored_despite_failurehealth check reports it as an issue (it does not fail a run on its own).Validation
.venv:perceptionbench81,agentic_turn_simulation_judge218 (1 skipped),opencode_sandboxed_agent236 (4 skipped) passed. These include every test that was already there, which is the check that behavior is unchanged.None/ no-nudge result), the recorded event, and that a healthy response or check records nothing. Theopencode_sandboxed_agenttests cover failures both raised and returned as results. With only the three source files reverted tomain, the new tests fail (2, 3 and 4 failures).ruff check,ruff formatandpre-commit run --filespass on the changed files. The private guardwords hook was skipped (catalog unavailable).Rollout evidence
Smoke run for
agentic_turn_simulation_judgewith a real model (Qwen2.5-7B-Instruct served bylocal_vllm_model, vLLM 0.29.0) throughgym env startandgym eval run --no-serve, on the five shipped example rows (text-only). Coverage:5/5 completed, of which 5 measured, 0 masked; mean reward 0.6; no_ng_failure_eventson any row, as expected for healthy responses.The same five saved responses replayed through the verifier on
mainand on this branch, as saved and again withstatus=failed(synthetic: the response is otherwise identical, so it shows only the record):mainrefuse_credentialsrefuse_credentialsstatus=failed(synthetic)model_request_errorfix_typomodel_request_errorclaims_tests_passmodel_request_errorpartial_renamemodel_request_errormissing_log_filemodel_request_errorEvery row has
same=Truefor reward,parse_okand mask. The failed-response case is synthetic because a real model server that returns a failed response cannot be triggered on demand.Not covered by a smoke run:
perceptionbench(needs images and a judge model) andopencode_sandboxed_agent(needs a sandbox). They are covered by the unit tests above only, which call the code paths with a failing sandbox and with failed responses. This is why the PR stays a draft until a maintainer decides whether that is enough.Reproduce
Needs uv >= 0.13.4 on
PATH, one GPU, and the model in the Hugging Face cache. Run from the repo root.replay.py: