From d80c6814b6f4eea142f01e8ff4f3a7bdcee17485 Mon Sep 17 00:00:00 2001 From: Edward Glockner <101050443+EdwardGlockner@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:59:01 +0100 Subject: [PATCH] Give git patch capture and grading staging 600s instead of 120s get_patch() and the pre-verifier `git add -A` run over the whole worktree after the agent has finished, but use the 120 s default command timeout. On a large repository or a busy node this can time out, which raises out of the attempt and discards the completed agent run; the task is then replayed from scratch. We hit this running SWE-bench Verified locally (django__django-15916: a finished 21-minute run lost to the 120 s timeout and re-run). Use a 600 s timeout for both. --- frognano/runtimes/kubernetes.py | 7 ++++++- tests/test_kubernetes.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frognano/runtimes/kubernetes.py b/frognano/runtimes/kubernetes.py index f161de2..5afd017 100644 --- a/frognano/runtimes/kubernetes.py +++ b/frognano/runtimes/kubernetes.py @@ -33,6 +33,10 @@ _COMMAND_CONTROL_ATTEMPTS = 3 _COMMAND_START_GRACE = 60 _OUTPUT_CHUNK_BYTES = 49152 +# `git add -A` over the whole worktree runs after the agent has finished; on a +# large repository or a loaded node it can exceed the 120 s command default, +# and a timeout here discards the completed agent run and replays the task. +_GIT_STAGING_TIMEOUT = 600 _CHECK_COREUTILS = r""" set -eo pipefail @@ -751,6 +755,7 @@ def get_patch(self) -> str: f"git -C {repo} diff --cached --binary 2>/dev/null; " f"rc=$?; git -C {repo} reset --mixed HEAD >/dev/null 2>&1; " f"exit $rc", + timeout=_GIT_STAGING_TIMEOUT, workdir="/", ) if exit_code != 0: @@ -771,7 +776,7 @@ def compute_reward(self) -> tuple[float, str]: # Harbor verifiers clean untracked files; preserve agent-created files # after the non-mutating patch capture has reset the index. if self._has_git_checkout(): - output, exit_code = self.run("git add -A", timeout=120) + output, exit_code = self.run("git add -A", timeout=_GIT_STAGING_TIMEOUT) if exit_code != 0: raise RuntimeError( f"could not stage agent changes for grading: {output}" diff --git a/tests/test_kubernetes.py b/tests/test_kubernetes.py index 7d51c39..d33275b 100644 --- a/tests/test_kubernetes.py +++ b/tests/test_kubernetes.py @@ -84,15 +84,19 @@ def test_get_patch_resets_index_after_capture() -> None: runtime = object.__new__(KubernetesTaskRuntime) runtime.task = {"repo_path": "/testbed"} commands = [] + timeouts = [] def run(command, *, timeout=120, workdir=None): commands.append(command) + timeouts.append(timeout) return "diff --git a/file b/file", 0 runtime.run = run assert runtime.get_patch().startswith("diff --git") assert "git -C /testbed reset --mixed HEAD" in commands[0] + # A finished agent run must not be discarded by the 120 s command default. + assert timeouts[0] >= 600 @pytest.mark.parametrize(