Fix: raise docker client timeout so slow evals aren't silently scored unresolved#111
Open
robdmac wants to merge 1 commit into
Open
Fix: raise docker client timeout so slow evals aren't silently scored unresolved#111robdmac wants to merge 1 commit into
robdmac wants to merge 1 commit into
Conversation
… unresolved docker.from_env() uses the SDK default 60s read timeout. On the --use_local_docker path, container.wait() then raises ReadTimeout for any test suite whose exec exceeds 60s (routine for Go/JS repos), so no output.json is written and the instance is silently scored unresolved. Add DOCKER_CLIENT_TIMEOUT (default 3600s, overridable via env) and use it for the docker client. Modal path unaffected. Fixes the false-negatives observed in scaleapi#54, scaleapi#22, scaleapi#23.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker.from_env() uses the SDK default 60s read timeout. On the --use_local_docker path, container.wait() then raises ReadTimeout for any test suite whose exec exceeds 60s (routine for Go/JS repos), so no output.json is written and the instance is silently scored unresolved.
Add DOCKER_CLIENT_TIMEOUT (default 3600s, overridable via env) and use it for the docker client. Modal path unaffected.
Fixes the false-negatives observed in #54, #22, #23.
Greptile Summary
This PR fixes silent scoring failures on
--use_local_dockerruns where test suites (especially Go/JS repos) take longer than the Docker SDK's default 60-second read timeout, causingcontainer.wait()to raiseReadTimeoutbeforeoutput.jsonis written. The fix introduces a module-levelDOCKER_CLIENT_TIMEOUTconstant (default 3600 s, overridable via env) and passes it todocker.from_env().DOCKER_CLIENT_TIMEOUT = int(os.environ.get("DOCKER_CLIENT_TIMEOUT", "3600"))as a named, overridable constant replacing the implicit SDK default.docker.from_env(timeout=DOCKER_CLIENT_TIMEOUT)so all Docker API calls on the local path — includingcontainer.wait()— use the extended timeout.Confidence Score: 4/5
Safe to merge; the fix correctly targets the root cause of silent unresolved scoring on long-running test suites.
The change is minimal and well-scoped. The only subtlety is that the new timeout applies to every Docker API call on the client — including image pulls — not just container.wait(). A stalled registry pull would now block a worker for up to an hour instead of 60 s, but this is unlikely in practice and does not affect correctness.
swe_bench_pro_eval.py — specifically the images.pull() call that now shares the 3600 s timeout with container.wait()
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Eval as eval_with_docker() participant SDK as docker.from_env(timeout=3600) participant Daemon as Docker Daemon participant Container as Container Eval->>SDK: "docker.from_env(timeout=DOCKER_CLIENT_TIMEOUT)" SDK-->>Eval: client Eval->>Daemon: client.images.pull(image_uri) Daemon-->>Eval: image pulled Eval->>Daemon: "client.containers.run(..., detach=True, remove=True)" Daemon-->>Eval: container handle Eval->>Daemon: container.wait() note over Eval,Daemon: Blocks up to 3600s (was 60s) Daemon->>Container: runs entryscript.sh Container-->>Daemon: exit code Daemon-->>Eval: StatusCode Eval->>Eval: collect_outputs_local() → output.json written%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Eval as eval_with_docker() participant SDK as docker.from_env(timeout=3600) participant Daemon as Docker Daemon participant Container as Container Eval->>SDK: "docker.from_env(timeout=DOCKER_CLIENT_TIMEOUT)" SDK-->>Eval: client Eval->>Daemon: client.images.pull(image_uri) Daemon-->>Eval: image pulled Eval->>Daemon: "client.containers.run(..., detach=True, remove=True)" Daemon-->>Eval: container handle Eval->>Daemon: container.wait() note over Eval,Daemon: Blocks up to 3600s (was 60s) Daemon->>Container: runs entryscript.sh Container-->>Daemon: exit code Daemon-->>Eval: StatusCode Eval->>Eval: collect_outputs_local() → output.json writtenComments Outside Diff (1)
swe_bench_pro_eval.py, line 384-389 (link)timeoutpassed todocker.from_env()is a socket-level read timeout that applies to all API calls on this client, includingimages.pull(). A hung or very slow registry pull will now block for up to 3600 s before raising an error, which may leave a worker silently stalled. Consider using a shorter, separate timeout for the pull call viadocker.APIClientor by wrappingimages.pull()with athreading.Timer, or at minimum document this tradeoff in the comment.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "Fix: raise docker client timeout so slow..." | Re-trigger Greptile