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 <noreply@anthropic.com>
This commit is contained in:
parent
565ba11790
commit
a93996094d
@ -171,8 +171,10 @@ class SWEAgenticEnvironment(Environment):
|
|||||||
total_usage = total_usage + out.usage
|
total_usage = total_usage + out.usage
|
||||||
text = out.text or ''
|
text = out.text or ''
|
||||||
if SENTINEL in text:
|
if SENTINEL in text:
|
||||||
# payload after the sentinel echo = `cat patch.txt` output
|
# payload after the sentinel echo = `cat patch.txt` output.
|
||||||
patch = text.split(SENTINEL, 1)[1].strip()
|
# 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
|
break
|
||||||
if out.tool_calls:
|
if out.tool_calls:
|
||||||
messages.append(ChatMessage(role='assistant', content=text))
|
messages.append(ChatMessage(role='assistant', content=text))
|
||||||
@ -184,7 +186,7 @@ class SWEAgenticEnvironment(Environment):
|
|||||||
content=f"exit={res['exit']}\n{res['out']}"))
|
content=f"exit={res['exit']}\n{res['out']}"))
|
||||||
if SENTINEL in res['out']:
|
if SENTINEL in res['out']:
|
||||||
# sentinel appeared in command output: capture patch
|
# 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:
|
else:
|
||||||
# no tool call: nudge per protocol
|
# no tool call: nudge per protocol
|
||||||
messages.append(ChatMessage(role='assistant', content=text))
|
messages.append(ChatMessage(role='assistant', content=text))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user