entrypoint override passes only the script path

With --entrypoint python3, our 'python /work/main.py' runner became
interpreter args: python3 tried to open a FILE named 'python'
("can't open file '/app/python'"). When an entrypoint is set it IS
the interpreter -- pass just /work/<entry>.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-17 03:31:24 +00:00
parent 774d2b9910
commit cf9a3f6d3f

View File

@ -91,13 +91,17 @@ class DockerSandbox(Sandbox):
out_host = Path(hpath).expanduser()
out_host.mkdir(parents=True, exist_ok=True)
cmd += ['-v', f'{out_host}:{cpath}:rw']
runner = ['python', f'/work/{entry}'] if entry.endswith('.py') \
else ['sh', f'/work/{entry}']
if entrypoint:
# images with an official-evaluator ENTRYPOINT (bigcodebench:
# python3 -m bigcodebench.evaluate) swallow our runner as
# CLI args -> override it so main.py actually executes
# CLI args -> override it. The entrypoint IS the interpreter
# now: pass only the script path, else 'python3 python
# /work/main.py' tries to open a file named 'python'
cmd += ['--entrypoint', entrypoint]
runner = [f'/work/{entry}']
else:
runner = ['python', f'/work/{entry}'] if entry.endswith('.py') \
else ['sh', f'/work/{entry}']
# Named + retried runs. A timed-out/killed `docker run` only kills
# the CLI client -- the container lives on (--rm fires on EXIT)
# and leaked containers slowly drown the daemon; the name gives