Skip to content

feat(swe_agents): add opt-in unfinished_episodes="fail" - #4036

Open
linj-glitch wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/swe-agents-unfinished-as-failures
Open

linj-glitch wants to merge 3 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/swe-agents-unfinished-as-failures

Conversation

@linj-glitch

@linj-glitch linj-glitch commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Add unfinished_episodes: "fail" for training. Turn-cap, context-window, and loop-detector exits remain in the loss with reward 0. The default "mask" preserves existing behavior: turn-cap/context exits are masked and loop exits receive their measured patch reward. The new unfinished metric records either mode, while resolved retains the measured test verdict. Independent infrastructure masks remain unchanged.

No separate issue is needed for this focused training-policy option. Benchmark configurations should retain the default; opting in can lower reward-derived scores for unfinished episodes whose patch passes tests.

Validation

At 6cdddb4f5714170eaad98bf52f42e563a3d71ca8, including main f36e126547866601bee9c0671c9b59484ef83723, Python 3.13.14 imports were verified against the isolated PR checkout:

  • Full responses_api_agents/swe_agents/tests: 230 passed. Cases cover both modes, all three unfinished outcomes, measured verdict retention, legacy metrics, final reward, and independent infrastructure masks.
  • pre-commit run --all-files: passed.

Rollouts

The author previously ran the component policies in real OpenHands GRPO training. This is historical author-reported evidence; no new live model/agent/verifier rollout is claimed for this head. The default behavior is unchanged.

Checklist

  • Read the contributing guidelines; changes remain focused.
  • Tests and documentation updated.
  • Full pre-commit checks pass.
  • All commits include DCO sign-off.

Required current-head CI and maintainer approval remain merge gates.

@copy-pr-bot

copy-pr-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 added area:agent Agent harnesses and Responses API agent behavior complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 5, 2026
@linj-glitch
linj-glitch marked this pull request as draft October 5, 2026 06:10
@linj-glitch
linj-glitch force-pushed the linj/swe-agents-unfinished-as-failures branch from 2b90900 to 3bc3e7d Compare October 8, 2026 00:15
Episodes that OpenHands stops at agent_max_turns (max_iteration) or that run
out of context (context_window) are masked from the loss, and episodes its
loop detector stops (stuck_in_loop) are graded on whatever patch is on disk.
For evaluation that is reasonable, but under RL it means running out the
budget never costs anything: a policy that wanders for the full turn budget
simply drops out of the batch, and one that loops after writing a working
patch still earns reward 1. In an internal GRPO run the share of held-out
tasks that hit the turn cap grew from 19 to 24 of 100 within 11 steps, and
loop-detector exits grew from 0 to 29% of tasks while a sizeable fraction of
them still scored.

`unfinished_episodes: fail` keeps all three kinds in the loss with reward 0.
`resolved` still reports the measured test verdict, and the new `unfinished`
metric marks these episodes in both modes. OOM kills and agent / eval
wall-clock timeouts stay masked either way, since those depend on the
cluster as much as on the policy. The default, `mask`, keeps today's
behavior.

Signed-off-by: Lin Jia <linj@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linj-glitch
linj-glitch force-pushed the linj/swe-agents-unfinished-as-failures branch from 3bc3e7d to 4520359 Compare October 8, 2026 00:20
Signed-off-by: Lin Jia <linj@nvidia.com>
@linj-glitch
linj-glitch marked this pull request as ready for review October 13, 2026 23:08
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 14, 2026
@linj-glitch

Copy link
Copy Markdown
Collaborator Author

/ok to test 09daaa1

@linj-glitch

Copy link
Copy Markdown
Collaborator Author

/ok to test 6cdddb4

This branch was previously deployed

1 inactive deployment
public — 6cdddb4f Deployed Oct 24, 2026 by copy-pr-bot[bot] via release / finalize / notify #7069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants