From e3401f46118c6a034d1921b0f04c15f4a732ddc5 Mon Sep 17 00:00:00 2001 From: Doron Chen Date: Mon, 10 Aug 2026 11:09:52 +0300 Subject: [PATCH] fix(swe-agent): point sweagent at /testbed instead of a fake /workspace/repo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The benchmark's actual checkout — at the buggy commit grade.sh diffs against — lives at /testbed, not /workspace. The old run.sh instead git-init'd an empty placeholder repo at /workspace/repo with a single empty commit, so SWE-agent could never have graded correctly: any patch it produced was a diff against nothing, not against the real bug. Switch --env.repo.repo_name to `testbed` (LocalRepoConfig's `preexisting` type is a no-op copy, so it can point directly at the existing checkout) and drop the /workspace/repo git-init scaffolding entirely. This also removes the need for the /workspace directory itself, so the build-time `mkdir -p /workspace && chown 1002:0 /workspace && chmod g+rwX /workspace` step (added to fix a permission error when creating it) is now dead code and is removed along with it. Verified with: eval-containers run swe-bench --agent swe-agent --model gcp/gemini-3.5-flash-lite --local --task-id astropy__astropy-12907 — agent edits land in /testbed and grade.sh's diff against the real bug now reflects the agent's actual patch (reward:1, passed:true). Checked against: .agents/benchmarks/RULES.md Signed-off-by: Doron Chen --- containers/agents/swe-agent/Dockerfile | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/containers/agents/swe-agent/Dockerfile b/containers/agents/swe-agent/Dockerfile index c57362fa..ef9f0d14 100644 --- a/containers/agents/swe-agent/Dockerfile +++ b/containers/agents/swe-agent/Dockerfile @@ -38,19 +38,15 @@ export OPENAI_BASE_URL="${OPENAI_BASE_URL:-http://model:4000}" # gitpython refuses to read /opt/swe-agent's .git (owned by uid 0, but we're # uid 1002) without an explicit safe.directory override. git config --global --add safe.directory /opt/swe-agent -# LocalRepoConfig's copy() does `shutil.copytree(src, "/{basename}")` then -# `chown -R root:root` — both fail as a non-root uid. Use the `preexisting` -# repo type instead (its copy() is a no-op) with a pre-staged repo. -REPO=/workspace/repo -mkdir -p "$REPO" -if [ ! -d "$REPO/.git" ]; then - (cd "$REPO" && git init -q && git config user.email a@d.l && git config user.name d \ - && git commit --allow-empty -qm init) || true -fi -git config --global --add safe.directory "$REPO" +# The benchmark's actual checkout (at the buggy commit grade.sh diffs against) +# lives at /testbed, not /workspace — LocalRepoConfig's copy() would try to +# stage a copy of it under a basename dir anyway (and fails as non-root via +# chown), so use the `preexisting` repo type (its copy() is a no-op) pointed +# straight at /testbed. +git config --global --add safe.directory /testbed exec /opt/swe-agent-venv/bin/sweagent run --agent.model.name="openai/${EVAL_MODEL:-default}" --agent.model.per_instance_cost_limit=3 \ --agent.model.api_base="${OPENAI_BASE_URL:-http://model:4000}" --env.deployment.type=local \ - --env.repo.type=preexisting --env.repo.repo_name=workspace/repo --problem_statement.text="$TASK" + --env.repo.type=preexisting --env.repo.repo_name=testbed --problem_statement.text="$TASK" E ENTRYPOINT ["/run.sh"]