fix(issue-36): merge review - a prompt file the runner cannot write is a failed submit; S9 asserts the libc wording on Linux only; an empty prompt file is refused
- runner._run_cmd: the write of the prompt file was outside the cleanup and error handling that the exec had (merge review: claude H1, codex R1). A failed write now removes the partial file and returns the same 126 failed submit an unstartable wrapper does, so the loop ends with rc 1 and no traceback. Test S4c. - test S9 required the literal "File too large" in stderr; bash 3.2 on macOS prints nothing for EFBIG, so the whole suite failed on this host (agy, grok, codex R2). The contract asserted everywhere is rc != 0, no leftover file and the portable diagnostic line; the libc wording is checked on Linux only. - the wrapper accepted an empty --prompt-file and registered an empty prompt (claude H3); it is refused now. Test S1e. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
1 parent
59be1c8920
commit
708262a598
3 files changed
+63
-7
No files matched your search
@@ -469,12 +469,26 @@ class LoopRunner:
|
||||
# MAX_ARG_STRLEN (131,072 bytes on Linux), and a review prompt
|
||||
# carries the whole diff. The wrapper blocks until the job ends,
|
||||
# so nothing reads the file after it returns.
|
||||
self.mam_dir.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.NamedTemporaryFile("w", encoding="utf-8", dir=self.mam_dir,
|
||||
prefix=f"prompt-{self.loop_id}-", suffix=".md",
|
||||
delete=False) as fh:
|
||||
fh.write(p_text)
|
||||
prompt_file = fh.name
|
||||
prompt_file = ""
|
||||
try:
|
||||
self.mam_dir.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.NamedTemporaryFile("w", encoding="utf-8", dir=self.mam_dir,
|
||||
prefix=f"prompt-{self.loop_id}-", suffix=".md",
|
||||
delete=False) as fh:
|
||||
prompt_file = fh.name
|
||||
fh.write(p_text)
|
||||
except OSError as e:
|
||||
# The same class the shell paths handle (merge review H1): a
|
||||
# partial file is removed and the submit fails like an exec
|
||||
# error would, instead of the exception reaching the loop.
|
||||
if prompt_file:
|
||||
try:
|
||||
os.unlink(prompt_file)
|
||||
except OSError:
|
||||
pass
|
||||
msg = (f"cannot write the prompt file under {self.mam_dir}: {e} "
|
||||
f"(prompt {len(p_text.encode('utf-8'))} bytes)")
|
||||
return subprocess.CompletedProcess(["bash", str(wrapper_script), "submit"], 126, "", msg)
|
||||
cmd = [
|
||||
"bash", str(wrapper_script), "submit",
|
||||
"--agent-session", self.session_label(agent_session),
|
||||
|
||||
Reference in new issue
Block a user