Repository navigation
fix(agent): stop trajectories on incomplete reasoning - #3536
Merged
Merged
Conversation
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Signed-off-by: Igor Gitman <igitman@nvidia.com>
Kipok
marked this pull request as ready for review
September 18, 2026 18:20
bxyu-nvidia
approved these changes
Sep 18, 2026
Contributor
|
/ok to test 49d3e4f |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Stop SimpleAgent and SimpleAgentWithCompaction when the latest model response has no tool calls, including reasoning-only and empty responses. Previously, an untruncated reasoning-only response triggered another assistant turn without any intervening user message or tool result. This could repeat until the context was exhausted.
The agents now warn explicitly, mark the returned response and captured invocation incomplete, and preserve the model output and usage. Saved response metadata contains
ng_termination_reason(incomplete_reasoningorempty_output) andng_termination_messagewith the diagnosis. Existing metadata is preserved. Length truncation and content filtering retain their earlierincomplete_detailshandling; tool-call continuation and verifier-controlled rewards are unchanged.Revisits the continuation behavior introduced in #19. No separate issue is needed for this focused bug fix.
Validation
Rebased onto main at
64bf158da./runwith verification enabled or skipped and trajectory capture disabled.pre-commit run --all-files: passed.git diff --check: passed.Tests used the existing Gym virtual environment with namespace imports explicitly bound to this worktree to avoid testing its original editable checkout:
Rollouts
A captured GPQA no-tools episode made 11 model calls and accumulated 284,835 output tokens. Its first response contained 6,218 output tokens, reasoning only, and no
incomplete_details. Replaying that captured response through both patched agents stopped after one call, preserved the reasoning and usage, and marked the invocation incomplete.A fresh end-to-end GPQA smoke test completed successfully using this PR.
max_steps=0, retained uncapped output/full 262,144-token context and the recipe's temperature 1 / top-p 0.95.stop, 0length.status=incompleteandng_termination_reason=incomplete_reasoning, and received reward 0 from the normal MCQA verifier.Compatibility and benchmark impact
No configuration migration. Intentional behavior change: reasoning-only or empty responses no longer receive extra assistant turns to recover. Scores and token totals can therefore differ from previous runs. Consumers can identify these terminations via
response.statusandresponse.metadata; they are not mislabeled asmax_output_tokens. Rewards remain determined by the existing verifier.Checklist
pre-commit run --all-files).git commit -s).