Skip to content

fix(swebench): grade staged and committed fixes, not just unstaged changes - #4775

Merged
linj-glitch merged 2 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/swebench-patch-extraction
Oct 27, 2026
Merged

linj-glitch merged 2 commits into
NVIDIA-NeMo:mainfrom
linj-glitch:linj/swebench-patch-extraction

Conversation

@linj-glitch

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

Copy link
Copy Markdown
Collaborator

What

The swebench resources server's verify step extracted the model patch with git --no-pager diff, which only shows unstaged changes to tracked files. An agent that staged (git add) or committed its fix scored 0 with an empty patch.

This PR records HEAD once the session sandbox is ready (after the optional anti-cheating step, which rewrites refs but not the working tree) and, at verify time, runs git add -u followed by git diff --cached <seed HEAD>, so staged and committed changes to tracked files are graded. Binary-file sections are dropped (git apply cannot take them without binary data). Untracked files are deliberately left out: git add -A swept a generated Sphinx _build tree (1.1 MB of jquery) into a patch in the first smoke.

Why

Measured on SWE-bench Verified with the Claude Code CLI harness driving Nemotron 3 Nano through Switchyard (two independent arms):

arm rollouts committed staged only resolve among them
plain harness 3030 353 (11.7%) 65 (2.1%) 0.3%
ultracode harness 1325 126 (9.5%) 56 (4.2%) 0.8%

About 14% of rollouts in each arm lost their patch this way, roughly 4-5 points of absolute resolve rate per arm. The same behaviour (agents committing their work) is common to every CLI harness, so this affects all SWE-bench arms graded by this server.

Validation

  • Unit tests for the two pure helpers (patch_extraction_command, strip_binary_diffs) in resources_servers/swebench/tests/test_app.py.
  • Real rollouts: two 15-rollout smokes on SWE-bench Verified (Nemotron 3 Nano + Claude Code, enroot sandboxes). Every rollout that committed (7) now carries a non-empty patch; the largest patch is 10.5k chars after switching from git add -A to git add -u.
  • A full 500-task k=3 run on the corrected server: 39.6% task-mean resolve vs 29.6% on the same tasks with the old extraction (paired +10.0 pts, 95% CI [+7.8, +12.1]; the delta also includes a context-window fix on the harness side).

Scores from runs before this change are not comparable with runs after it.

Current-head validation — October 24, 2026

Merged main f36e126547866601bee9c0671c9b59484ef83723 additively into this branch, preserving the feature and including the shared Terminus shell-recovery fix (#4966) and MiniSWE test-isolation fix (#4735). No feature-specific conflict resolution was needed.

Validated 7c3ecc5f2b24910c7371aa5c89b1c73e65ae3201 on Python 3.13.14 with imports confirmed to resolve to this checkout:

  • python -m pytest -o addopts= --import-mode=importlib -q resources_servers/swebench/tests/test_app.py: 16 passed.
  • pre-commit run --all-files: passed on the final head.
  • Actual PR diff and description guardword checks, plus git diff --check: passed.

The rollout results above are historical; this main-compatibility refresh did not run new model rollouts. Current-head CI and repository-required approval remain merge gates.

@copy-pr-bot

copy-pr-bot Bot commented Oct 20, 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:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer labels Oct 20, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 21, 2026
…anges

The verify step extracted the model patch with 'git --no-pager diff', which
shows only unstaged changes to tracked files. An agent that staged ('git add')
or committed its fix scored 0 with an empty patch. On SWE-bench Verified with
the Claude Code harness this hit 14% of rollouts in two independent arms
(353 committed + 65 staged of 3030 rollouts in one, 126 + 56 of 1325 in the
other), each worth roughly 4-5 points of absolute resolve rate.

Record HEAD once the session sandbox is ready (after the optional anti-cheating
step, which rewrites refs but not the tree) and at verify time run 'git add -u'
followed by 'git diff --cached <seed HEAD>', so staged and committed changes to
tracked files are graded. Untracked files stay out on purpose: 'git add -A'
swept a generated Sphinx _build tree (1.1 MB of jquery) into a patch in the
first smoke. Binary-file sections are dropped, since 'git apply' cannot take
them without binary data.

Validated with real rollouts (two 15-rollout smokes on SWE-bench Verified with
Nemotron 3 Nano + Claude Code): every rollout that committed now carries a
non-empty patch; largest patch 10.5k chars.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Lin Jia <[email protected]>
@cmunley1

Copy link
Copy Markdown
Contributor

/ok to test bb3affa

@cmunley1

Copy link
Copy Markdown
Contributor

/review

@linj-glitch

Copy link
Copy Markdown
Collaborator Author

/ok to test 7c3ecc5

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 26, 2026
@linj-glitch
linj-glitch added this pull request to the merge queue Oct 26, 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/40421443791

@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/40423743663

Merged via the queue into NVIDIA-NeMo:main with commit e4ac571 Oct 27, 2026
46 of 49 checks passed
@linj-glitch
linj-glitch deleted the linj/swebench-patch-extraction branch October 27, 2026 00:32
bxyu-nvidia added a commit that referenced this pull request Nov 4, 2026
  - #3302: Reservation writes deferred until reporting/shutdown; in-memory tracking remains.
  - #4775: Restored unstaged-only git diff and removed the seed-commit lookup.

Signed-off-by: Brian Yu <[email protected]>

This branch was previously deployed

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

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants