Repository navigation
fix(stirrup_agent): grade unusable compaction summaries as the model's output - #5822
Conversation
…s output When the policy model returned no usable compaction summary on all three attempts, the agent raised a bare RuntimeError, the sandbox runner reported it as a runner failure and the environment server typed the episode environment_server_failed and retried it. The summary comes from the policy model, so a retry only re-samples the same model and the row is not an infrastructure fault. The agent now raises CompactionSummaryError with the context it was asked to summarize. The runner ends the episode as a failed response on every completed turn (stop_reason compaction_failed), and the agent classifies it as agent_invalid_output, which the default outcome policy verifies instead of retrying, as for other unusable model output. Signed-off-by: Adam Rajfer <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
RISK — Add the required real-model smoke evidence
The supplied PR description reports 96 unit tests and Ruff, but no representative real-model rollout or justified N/A. AGENTS.md requires real smoke rollouts for behavior-changing agent work. This change affects evaluation outcomes: the new classification sends previously retryable episodes to verification under the default policy. The added runner test injects the exception, and the wrapper test supplies a synthetic report; neither demonstrates the full model-to-verifier path. This is a validation gap, not a demonstrated runtime defect.
Correction: Could you add the model, task, configuration, commands, saved rollout artifact, and inspected agent/verifier result to the PR evidence? No implementation rewrite is requested. The invariant to demonstrate is that unusable policy summaries end and grade the current episode while retaining its completed work, rather than restarting it as an infrastructure failure.
Proposed acceptance checks:
- Run a real policy model on a task that reaches compaction, with a minimum-summary setting that rejects all three summaries. Confirm retained completed tool calls/results and task artifacts, response status
failed, stop reasoncompaction_failed, outcomeagent_invalid_output, and verifier execution without an agent-outcome retry under the default policy. - Retain a successful-compaction control that continues normally and replays only the sanitized summary, as asserted by the existing session compaction test.
- Preserve the existing rejected-request assertions: HTTP 400/413/422 remains
model_request_error, with known-zero usage when no model response was received.
I inspected all seven changed files and traced exception handling, history conversion, report transport, outcome policy, and environment verification. I found no additional source-supported defects. Inspection was static: I couldn't execute tests or rollouts, and the external Stirrup implementation wasn't mounted for independent inspection.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
agronskiy
left a comment
There was a problem hiding this comment.
Looks good, approving with a few nits.
Verified: the only NeMoAgent construction site is sandbox_runner.run, so the new except CompactionSummaryError covers the path that previously surfaced as an unclassified HTTP 500 from /run. Replacing the last turn snapshot with error.messages correctly retains the turn that triggered compaction, since Stirrup snapshots at turn start and compacts after the turn is appended. agent_invalid_output maps to VERIFY under the default policy, and 400/413/422 still classify as model_request_error. Stirrup tests pass (178), the two new tests fail without the fix, and ruff is clean.
Nits:
nemo_agent.py:CompactionSummaryErrorcarriescurrent_messages, which has already dropped a turn if a summary attempt hitContextOverflowErrorand unwound. The failed response then omits a turn thatmodel_response_idsand usage still count. Passing the originalmessageswould keep every completed turn, as the README now says.app.py:response.errorisNoneand theinvalid_outputtext isn't kept anywhere on the response. Consider adding it to metadata for diagnosis.app.pycomment: "never retried" depends on the outcome policy. Maybe "verified by default".
FYI for GDPVal users: these rollouts used to be rerun by recovery (HTTP 500 agent_run_error) and are now graded as the model's result, so scores on runs with compaction failures will shift. A note in the PR description would help.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42520527806 |
Merge main at 330c461 into the agentic CritPt branch. Where main has since added its own handling for something this branch also changed, the merge keeps main's version: - responses_api_models/vllm_model is identical to main. The exact completion fitting is dropped; main's refit_output_budget_to_prompt (NVIDIA-NeMo#5864) covers what the agentic recipe needs. - Stirrup compaction failure uses main's handling (NVIDIA-NeMo#5822) and its max_turns stop reason (NVIDIA-NeMo#5937). In finish_tool mode the grader scores an agent_invalid_output response zero as candidate_no_answer. - Context-overflow recovery becomes the opt-in Stirrup option context_overflow_recovery (default false). The runner reports the model server's own rejection. - The grader's execution sessions use ResourcesSessionLocks and ResourcesSessionFences (NVIDIA-NeMo#5083); agentic_execution refuses several workers (NVIDIA-NeMo#4790). - A semantic validator failure or timeout stays unscorable with score_comparator_uncertain_as_incorrect (NVIDIA-NeMo#5416). - nemo_gym/ is unchanged. Two fixes found while validating the merge: - Since NVIDIA-NeMo#5128 the single_agent_turn environment servers and the agents that verify through verify_agent_response send failure_report with every /verify request. The grader read it as an unknown task field and answered task_invalid for every such rollout; it is now a framework field. - tests/test_runner_remote.py built ExecutionPolicy with four arguments the policy does not have and expected a 2 GiB address-space limit it never set, so nine of its tests failed; both are corrected. Also included: fixes from a review of the merged diff (session glossary wording, main's lost-session body on /code_exec, tighter execution limits, a stopped session releasing its capacity slot, route tests, and a local end-to-end grade of a semantic-validator task). Signed-off-by: Erik Arakelyan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
When the policy model returns no usable compaction summary on all three attempts, the stirrup agent raised a bare
RuntimeError. The sandbox runner reported it as a runner failure, the agent route returned HTTP 500, and the environment server typed the episodeenvironment_server_failedand retried it. The summary comes from the policy model, so a retry only re-samples the same model; it is not an infrastructure fault.Change
nemo_agent.py: raiseCompactionSummaryError(aRuntimeErrorsubclass) carrying the context it was asked to summarize.sandbox_runner.py: end the episode as a failed response that keeps every completed turn (stop_reasoncompaction_failed), as the 4xx model error path already does.app.py: classify that response asagent_invalid_output, which the default outcome policy verifies instead of retrying, as for other unusable model output.Tests
The new and changed tests fail before the change and pass after it (96 of 96 in the three touched test files). Ruff is clean.