Skip to content

Commit 7e85c91

Browse files
authored
Merge pull request #62 from BaseIntelligence/fix/agent-install-allow-pypi-index
fix(agent-challenge): allow PyPI index for agent dependency install
2 parents 619e8a9 + bdef8e1 commit 7e85c91

3 files changed

Lines changed: 27 additions & 31 deletions

File tree

packages/challenges/agent-challenge/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ COPY golden/dataset-digest.json ./golden/dataset-digest.json
134134

135135
RUN pip install --no-cache-dir .
136136

137-
# Pre-bake the toolchain a submitted agent needs so its install resolves fully
138-
# offline. Runner jobs run on an egress-free network, so own_runner installs the
139-
# agent with `--no-index --no-build-isolation` (see runner._own_runner_script).
137+
# Pre-bake common PEP 517 build backends and agent runtime deps so installs
138+
# are faster and more reliable. own_runner still resolves remaining agent
139+
# deps from PyPI (see runner._own_runner_script).
140140
RUN pip install --no-cache-dir \
141141
"setuptools>=61" \
142142
"wheel>=0.40" \

packages/challenges/agent-challenge/src/agent_challenge/evaluation/runner.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,14 +2000,11 @@ def _own_runner_script(
20002000
# (no inner dockerd). The default socket path needs no DOCKER_HOST, but we
20012001
# set it explicitly so a custom broker socket path still resolves.
20022002
#
2003-
# Offline agent install: runner jobs are attached to an egress-free network
2004-
# (a security boundary for untrusted agent code), so the install must resolve
2005-
# entirely from packages pre-baked into the runner image. --no-build-isolation
2006-
# reuses those baked PEP 517 build backends instead of fetching them into a
2007-
# fresh isolated build env (the setuptools>=61 fetch that previously failed
2008-
# every install), and --no-index keeps a missing/exotic dep failing fast
2009-
# instead of hanging on unreachable pypi retries. `|| true` preserves the
2010-
# best-effort behaviour so a partially-satisfiable agent still attempts to run.
2003+
# Agent dependency install: resolves from PyPI on the host-local evaluation
2004+
# path (CHALLENGE_NO_PHALA / unattested), which has egress. The egress-free
2005+
# --internal overlay applies only to the broker/Swarm job path, not here.
2006+
# Network-sane retries/timeouts; `|| true` keeps best-effort behaviour so a
2007+
# partially-satisfiable agent still attempts to run.
20112008
return f"""
20122009
set -u
20132010
cd /workspace/agent
@@ -2016,7 +2013,7 @@ def _own_runner_script(
20162013
{replay_env}
20172014
TMO="timeout -k 10 -s KILL 600"
20182015
PIP="python -m pip install --no-input --disable-pip-version-check"
2019-
PIP="$PIP --no-index --no-build-isolation --retries 0 --default-timeout 15"
2016+
PIP="$PIP --retries 3 --default-timeout 30"
20202017
if [ -f requirements.txt ]; then $TMO $PIP -r requirements.txt || true; fi
20212018
if [ -f pyproject.toml ]; then $TMO $PIP -e . || true; fi
20222019
mkdir -p {output_dir}

packages/challenges/agent-challenge/tests/test_evaluation.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,18 +2428,15 @@ def test_own_runner_script_cache_wiring_honours_settings_overrides(monkeypatch):
24282428
assert "--digest-manifest /custom/golden/digest.json" in script
24292429

24302430

2431-
def test_own_runner_script_pip_installs_are_offline_and_hang_proofed():
2432-
"""Runner jobs run on an egress-free network, so the agent install must
2433-
resolve entirely from packages pre-baked into the runner image and must fail
2434-
fast rather than hang on unreachable pypi.
2435-
2436-
Regression (score-0.0 bug): every terminal-bench task scored 0.0 because the
2437-
agent install reached out to pypi and failed/hung. The fix installs with
2438-
``--no-build-isolation`` (reuse the pre-baked PEP 517 build backends instead
2439-
of fetching setuptools>=61 into a fresh isolated build env) and ``--no-index``
2440-
(a missing/exotic dep fails immediately instead of retrying pypi for ~150s).
2441-
Both installs stay wrapped in a hard ``timeout -k 10 -s KILL`` safety net and
2442-
keep ``|| true`` so a partially-satisfiable agent still attempts to run.
2431+
def test_own_runner_script_pip_installs_use_pypi_with_sane_retries():
2432+
"""Agent install resolves from PyPI with network-sane pip flags.
2433+
2434+
Host-local evaluation has egress to PyPI; ``--no-index`` was blocking real
2435+
agent deps (e.g. litellm>=1.55.0) with an instant empty-index failure.
2436+
The install keeps ``--no-input`` / ``--disable-pip-version-check``, uses
2437+
retries/timeouts suitable for network installs, stays wrapped in a hard
2438+
``timeout -k 10 -s KILL`` safety net, and keeps ``|| true`` so a
2439+
partially-satisfiable agent still attempts to run.
24432440
"""
24442441

24452442
job = EvaluationJob(job_id="job-hangproof", selected_tasks_json="[]")
@@ -2454,16 +2451,18 @@ def test_own_runner_script_pip_installs_are_offline_and_hang_proofed():
24542451

24552452
assert 'TMO="timeout -k 10 -s KILL 600"' in script
24562453
assert "python -m pip install --no-input --disable-pip-version-check" in script
2457-
# Offline-first: no isolated build env, no pypi index, fail fast.
2458-
assert "--no-build-isolation" in script
2459-
assert "--no-index" in script
2460-
assert "--retries 0 --default-timeout 15" in script
2461-
# Both install paths carry the offline flags and stay best-effort.
2454+
# PyPI-reachable install: no offline-only flags; network-sane retries.
2455+
assert "--no-index" not in script
2456+
assert "--no-build-isolation" not in script
2457+
assert "--retries 3 --default-timeout 30" in script
2458+
# Both install paths stay best-effort under the hard timeout.
24622459
assert "$TMO $PIP -r requirements.txt || true" in script
24632460
assert "$TMO $PIP -e . || true" in script
24642461
pip_flag_line = next(line for line in script.splitlines() if line.startswith('PIP="$PIP'))
2465-
assert "--no-index" in pip_flag_line
2466-
assert "--no-build-isolation" in pip_flag_line
2462+
assert "--no-index" not in pip_flag_line
2463+
assert "--no-build-isolation" not in pip_flag_line
2464+
assert "--retries 3" in pip_flag_line
2465+
assert "--default-timeout 30" in pip_flag_line
24672466

24682467

24692468
def test_own_runner_command_args_wires_cache_root_and_digest_manifest():

0 commit comments

Comments
 (0)