Repository navigation
fix(agent_arena): treat a time-capped turn as an environment-side failure - #5872
AdamRajfer wants to merge 2 commits into
Conversation
…lure A turn that hit the agent's wall-clock cap was masked by the resources server under the namespaced kind agentic_turn_simulation:time_cap, with the partial response kept. Recovery keeps a masked row that holds a saved answer, and treats a namespaced kind as unclassified, so nothing retried it and the row stayed silently masked. The cap tracks how fast the policy, simulator and judge were served, not what the policy did. The agent's /run now returns a time-capped turn as a typed agent_time_cap failure (a new registered kind, evaluation-side), like its confirmed model-timeout rows. The collector retries it within the attempt budget, and once that is spent it stays an unscored failed row. outcome_policy selects the action by kind (default retry; fail or count_as_zero). Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 00cfd64 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
Two correctness risks remain: recovery rejects the advertised count_as_zero outcome, and the override discards completed reference-turn grades. Required real-model smoke evidence is also missing.
NOTE — Update the remaining guidance for time-cap failures
The training guide still describes time caps as masked rows that trainers can filter with mask_sample or rescore using stop_reason. The evaluation reporting instructions likewise count only masked results in the main output. After this change, capped /run replies have neither field nor a saved response, and collection saves them in the failure sidecar. Those instructions no longer account for capped turns.
Suggested correction: Replace the training guide's time-cap filtering advice with:
Through the shipped agent's
/run, a time-capped turn is anagent_time_capfailure without a reward or saved response. Handle it before reward or advantage computation;mask_sampledoes not select these failures. Configureoutcome_policy.by_failure_kind.agent_time_capto choose retry, final unscored failure, or explicit zero scoring.masked_stop_reasonsstill controls resources-server/verifyresults, but does not override this/runconversion.
Update the reporting instructions to count selected time-cap failures separately from masked results. Read the Store's latest selected failures rather than concatenating attempts; otherwise a cap followed by a successful retry is counted twice.
Preservation and proposed acceptance checks: Keep masking guidance for simulator failures, first-step context overflow, and direct /verify calls. A saved run with one exhausted cap must report one selected agent_time_cap failure even though its main output has no masked cap row. A cap superseded by a successful retry must not remain in that selected-failure count. Direct /verify time-cap masking and configurable max_steps masking must remain documented, matching the existing assertions.
I inspected all seven changed files and their directly affected paths. Two delegated inspections were cancelled; I completed those topics directly. This was a static, read-only review: I didn't execute tests or rollouts, and suggested patches need verification before adoption.
Inline comments (escaped v1):
-
nemo_gym/orchestration/recovery.pyline 1295: RISK — Admit the advertised time-cap zero in recovery.With
outcome_policy.by_failure_kind.agent_time_cap: count_as_zero, the new producer emits a terminal counted-zero failure whose selected event isagent_time_capatagent.agent_time_cap. Collection counts that row as zero and the Store settles it, but this recovery branch accepts only four model kinds and rejects agent operations other thanagent.policy_request. Consequently, the capped identity becomesunknown,decision.completestays false, and recovery stops despite the explicitly settled zero. This affects the newly documented policy option, not default retry.Correction: Add narrow support for this producer's counted zero without accepting arbitrary infrastructure zeros. For example, import
AGENT_TIME_CAPand replace thestateassignment here with:cap_zero = ( model_cause == AGENT_TIME_CAP and chain is not None and len(chain) == 1 and chain[0][:2] == (FailureBoundary.AGENT, "agent.agent_time_cap") ) state = ( IdentityState.MODEL_FINAL if is_terminal_failure(last) and ((model_kind and not contradictory) or cap_zero) else IdentityState.UNKNOWN )
Here
MODEL_FINALis the existing settled-sidecar state; the cap's responsibility must remain evaluation-side through the shared classifier. This suggested patch is source reasoning, not an executed result.Preservation and proposed acceptance checks: Extend
TestTimeCapRecoverywith a real_saved_row(...count_as_zero...), persist it using the existing Store helper, and run_decide: expect{"scored": 1, "model_final": 1},complete=True, and no pending retry. Through collection, one healthy reward and one capped zero must aggregate as[0.0, 1.0], while the failure sidecar still has no reward. Retain default retry/exhaustion and terminalfail. Keep confirmed policy-timeout zeros accepted, and keep nonterminal, missing/cyclic-report, wrong-boundary, and unrelated infrastructure-zero rows rejected. Verify that fault reporting still classifies the cap as evaluation-side. -
responses_api_agents/agentic_turn_simulation_agent/app.pyline 319: RISK — Preserve grades whenscore_sourceisreference_turn.Run this pairing with
score_source: reference_turn, a complete recorded reference, and a policy turn that reachestime_cap. The resources server deliberately ignores policy stop reasons in reference mode, sosuper().run()returns the recorded turn's completed grade. This unconditional conversion then discards that grade and returns a retryable failure because the unrelated policy hit its cap. Baseline scoring can repeatedly judge the same reference and eventually leave it unscored, although the reference itself was fully gradable.Correction: Exempt verified reference-turn results from the policy time-cap conversion. The verifier already returns
score_source, andSimpleAgentVerifyResponsepreserves extra fields. Replace this guard with:if metadata.get("stop_reason") != "time_cap" or getattr(result, "score_source", None) == "reference_turn": return resultThe invariant is that the cap invalidates a policy turn, not an independently recorded reference turn.
Preservation and proposed acceptance checks: Add reference-mode cases whose policy metadata says
time_cap: a passing reference must retain reward1.0, a failing reference must retain0.0, and a reference ending immediately after a tool result must retain itsrecording_cut_offmask. Keep the existing reference-mode assertion that the policy'smax_stepsdoes not affect its grade. In policy mode, the same capped response must still becomeagent_time_cap; non-capped results and already-returned failure responses must remain unchanged. These checks and the suggested guard haven't been executed in this review. -
responses_api_agents/agentic_turn_simulation_agent/app.pyline 315: RISK — Record the required representative model smoke rollout.The PR explicitly reports no model smoke run, but this override changes a capped
/runfrom a masked result with a response into a failure without a reward or response. Protected AGENTS.md requires representative real smoke rollouts for behavior-changing agent work. The new test helper supplies both the episode metadata and verification reply; it doesn't exercise the actual policy → episode → verifier path. The stated unit-test results don't satisfy that separate evidence requirement.Correction: Run the paired agent/resources server with a real model on a representative tool-using row, using a reduced cap that expires after some work. Record the command/config, model identities, rollout artifacts, and inspected agent/verifier behavior in the PR. This reusable environment doesn't require a fixed-benchmark reward-distribution comparison for this change.
Preservation and acceptance: Confirm that the capped
/runproducesfailure_kind: agent_time_capwithoutreward,mask_sample, orresponse, closes its resources session, and leaves a retryable saved attempt under the default policy. Run a neighboring non-capped turn and confirm that its verified response and reward remain intact. Retain the deterministic assertions for exhaustion and terminalfail. These are requested checks, not results I executed; no implementation patch follows solely from this evidence gap.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 59c1090 |
|
Closing as a duplicate of #6072 with #6070. There, the turn simulation environment declares |
A turn that hit the agent's wall-clock cap was masked by the resources server under the namespaced kind
agentic_turn_simulation:time_cap, with the partial response kept. Recovery keeps a masked row that holds a saved answer and treats a namespaced kind as unclassified, so nothing retried it: the row stayed silently masked. The cap tracks how fast the policy, simulator and judge are served, not what the policy did.The agent's
/runnow returns a time-capped turn as a typedagent_time_capfailure (new registered kind, evaluation-side), the way it already returns confirmed model-timeout rows. The collector retries it within the attempt budget, and once that is spent it stays an unscored failed row.outcome_policyselects the action by kind:retryby default,failto leave it final and unscored,count_as_zeroto score it 0. A turn that ends on any other stop reason is verified as before, and the resources server still maskstime_capfor callers that do not go through the agent's/run.Compatibility: through
/runa time-capped turn no longer comes back as a masked row withreward: 0.0; it is a failure row with no reward. A training consumer that expects a reward on every/runreply would see a failure instead.Validation:
agentic_turn_simulation_agent,agentic_turn_simulationandagent_arenaunit tests, plus the failure-kind, outcome-policy, moved-paths and recovery tests they touch: 1332 passed.retryable, three areexhausted,failmakes itterminal, and the old masked row was final.ruff checkandruff formatclean.Rollout evidence: N/A, no model smoke run; the change is the row the agent returns at the cap and how recovery reads it.