Skip to content

fix(stirrup): report a run that exhausts its turns as stop_reason max_turns - #5937

Merged
mpatel31415 merged 1 commit into
NVIDIA-NeMo:mainfrom
AdamRajfer:arajfer/stirrup-max-turns-stop-reason
Nov 10, 2026
Merged

mpatel31415 merged 1 commit into
NVIDIA-NeMo:mainfrom
AdamRajfer:arajfer/stirrup-max-turns-stop-reason

Conversation

@AdamRajfer

Copy link
Copy Markdown
Contributor

What does this PR do?

A Stirrup run that uses all of agent_max_turns without calling a finish tool answers status: incomplete with no stop_reason. In the rollout data it looks the same as any other incomplete response, so a turn-capped row cannot be told apart from an unexplained one when reading a run.

The sandbox runner now records stop_reason: max_turns in that case, the same way a wall-time stop records wall_time. Stirrup's run() only returns without finish params when the turn budget is spent (cancellation, model rejection and compaction failure already set their own reasons), so the label is unambiguous. The response stays incomplete and is verified and graded exactly as before.

Validation

  • pytest responses_api_agents/stirrup_agent/tests: 179 passed.
  • With the runner change reverted, the two updated turn-exhaustion tests (test_sandbox_runner.py, test_sessions.py) fail; with it they pass.
  • ruff check and ruff format --check on responses_api_agents/stirrup_agent: clean.

Rollouts

N/A for new rollouts: the change adds one metadata field and does not change the status, output items or grading. The tests drive the real Stirrup loop against a fake model server until it runs out of turns.

Compatibility and benchmark impact

None for scores. Responses of turn-capped runs gain metadata.stop_reason: max_turns; consumers that only read status see no difference.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification. (README row for agent_max_turns.)
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header. (No new files.)
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

…_turns

A Stirrup run that used every turn without a finish call answered
status incomplete with no stop_reason, so it could not be told apart
from other incomplete responses in the rollout data. Record
stop_reason max_turns, the same way a wall-time stop records
wall_time. The response stays incomplete and is graded as before.

Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Nov 10, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 0ecbd49

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP

LGTM — no concerns found. I reviewed all four changed files and traced max_turns through response metadata, observations, and grading. The guard preserves existing stop reasons and the incomplete status. The updated tests assert both runner and session behavior.

Static review only; I didn't run tests or CI. Stirrup's external loop source isn't included, so I couldn't independently verify all of its return paths.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@AdamRajfer
AdamRajfer requested a review from ananthsub November 10, 2026 15:52

@mpatel31415 mpatel31415 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full diff and Stirrup 0.1.12 return paths. The new reason applies only to a return without finish parameters or an existing stop reason; cancellation, model failure and unusable compaction summaries retain their reasons and status/grading behavior. Independently ran the exact-head component suite: 170 passed; nine session-supervisor cases fail on macOS because /proc/uptime is absent, before reaching their assertions. A representative affected session case fails identically on parent 3783d71. The changed direct-runner max-turns regression passes; required Linux CI is green. Metadata-only change; new model rollout evidence is not applicable. No findings.

@mpatel31415
mpatel31415 added this pull request to the merge queue Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42896895542

Merged via the queue into NVIDIA-NeMo:main with commit 414d9ec Nov 10, 2026
91 of 96 checks passed
osoblanco added a commit to osoblanco/Gym that referenced this pull request Nov 15, 2026
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]>
yaoyu-33 added a commit that referenced this pull request Nov 18, 2026
…-python-host-adapters

Resolve the Stirrup conflicts: keep the ladder's metadata (an optional
elapsed_seconds and stop_reason) and add the agent_timeout_sec key and
resolve_agent_timeout from the base.

The base now carries #5937, whose runner reports stop_reason="max_turns"
when Stirrup runs out of turns. Read the turn limit from that stop reason
instead of from an incomplete run without one, so such a run stays
incomplete (agent_limit) instead of failing as agent_run_error.

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

This branch was previously deployed

1 inactive deployment
public — 0ecbd49a Deployed Nov 10, 2026 by copy-pr-bot[bot] via release / finalize / notify #11434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants