From a93996094d5e9dd1c7a3b9b3d331528209f3bf23 Mon Sep 17 00:00:00 2001 From: sora <2075279110@qq.com> Date: Fri, 18 Sep 2026 08:22:59 +0000 Subject: [PATCH] swe_agentic: sentinel patch must end with a newline The captured diff was stripped, and git apply rejects diffs whose last line lacks a trailing newline ('corrupt patch at line N') -- the first agentic score was resolved=0 with patch_apply_failed despite a correct fix. Verified: same payload + newline applies clean in the official container. Co-Authored-By: Claude --- evalharness/agent/envs/swe_agentic.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/evalharness/agent/envs/swe_agentic.py b/evalharness/agent/envs/swe_agentic.py index f99b212..c1f18cb 100644 --- a/evalharness/agent/envs/swe_agentic.py +++ b/evalharness/agent/envs/swe_agentic.py @@ -171,8 +171,10 @@ class SWEAgenticEnvironment(Environment): total_usage = total_usage + out.usage text = out.text or '' if SENTINEL in text: - # payload after the sentinel echo = `cat patch.txt` output - patch = text.split(SENTINEL, 1)[1].strip() + # payload after the sentinel echo = `cat patch.txt` output. + # A unified diff must end with a newline; a stripped + # payload fails git apply with 'corrupt patch at line N' + patch = text.split(SENTINEL, 1)[1].strip() + '\n' break if out.tool_calls: messages.append(ChatMessage(role='assistant', content=text)) @@ -184,7 +186,7 @@ class SWEAgenticEnvironment(Environment): content=f"exit={res['exit']}\n{res['out']}")) if SENTINEL in res['out']: # sentinel appeared in command output: capture patch - patch = res['out'].split(SENTINEL, 1)[1].strip() + patch = res['out'].split(SENTINEL, 1)[1].strip() + '\n' else: # no tool call: nudge per protocol messages.append(ChatMessage(role='assistant', content=text))