feat: cloud-native runner + pod-native SWE-bench sandbox (run evals in Kubernetes) - #238
Open
almogtavor wants to merge 15 commits into
Open
feat: cloud-native runner + pod-native SWE-bench sandbox (run evals in Kubernetes)#238almogtavor wants to merge 15 commits into
almogtavor wants to merge 15 commits into
Conversation
…bench) Adds runner="kubernetes": launches `exgentic serve` as a ConfigMap+Pod+Service (kubectl apply, JSON manifests, no PyYAML/k8s-client dep) and returns the same ObjectProxy over HTTPTransport as DockerRunner. Reach the service via in-cluster DNS or a kubectl port-forward (port_forward=True) when driving from a laptop. SWE-bench / docker_socket=True benchmarks get an in-pod container runtime so the existing sibling-container + run_evaluation code runs unchanged: rootless podman (sandbox="podman", default) or a privileged docker:dind sidecar (sandbox="dind"). Registered in with_runner() + both RunnerName Literals; runner_mixin maps the docker host-bind output volume to a shared PVC via new EXGENTIC_KUBERNETES_* settings.
…ce teardown for KubernetesRunner
…ading, no docker/privileged)
…etesRunner (superseded by pod-native SWE-bench sandbox)
…sing (self-hosted/vLLM)
… grading so the session score records resolved
Three changes so the slower middleware (span/full-recompute) modes get a fair, fully-graded run instead of being cut off: - pod TTL decoupled from the per-command timeout (SWEBENCH_POD_TTL, default 4h): the task pod must outlive the whole session so end-of-session grade_in_pod can still kubectl-exec in. Previously the pod slept for one command timeout and expired mid-session, silently leaving capped tasks ungraded. - litellm request timeout 180 -> 600 (EXGENTIC_LITELLM_TIMEOUT): a cold span/ full-recompute deploy's first call (warmup prefill) ran past 180s and failed with 'Model not accessible: TimeoutError()' at step 0. - max_interactions 200 -> 1000 so a 500-step run is bounded by the step cap.
gemma-4 and reasoning models can collapse into re-issuing the identical tool call indefinitely (vLLM #40080); sampler penalties only partially help. Track the (name, arguments) signature per turn and, after 3 identical calls in a row, append a nudge to the next tool result so the model gets different feedback and takes a new action. Self-resets after nudging; a different call resets the count.
A bash-only agent has to edit source via heredocs/sed, which weaker models (gemma-4) get wrong - so they default to re-running the reproduction forever instead of editing. Add the standard SWE-bench editor seam (view, create, str_replace) to the benchmark action registry so any agent (tool_calling included) gets reliable, patch-captured edits. All routed through the existing sandbox via base64 to avoid shell-quoting fragility; str_replace enforces a unique match and errors clearly otherwise.
When the identical (name, arguments) tool call repeats _max_repeated_tool_calls times in a row, react() refuses to execute it: inject a synthetic blocked tool result and re-query the model in-place so it must choose a different action. After _max_hard_block_retries unproductive re-queries the session ends. Replaces the soft nudge, which gemma-4 ignored (vLLM #40080).
SWE-bench instance images own /testbed (repo + .git) as root. The kube_sandbox pod set no runAsUser, so OpenShift assigned a random uid that could not write the root-owned source AND tripped git's dubious-ownership guard -> generate_patch (git add -A && git diff) returned empty and correct fixes were silently scored 0. Force runAsUser=0 (exgentic-task SA has anyuid) + add safe.directory '*' belt.
Old SWE-bench repos (astropy) rebuild editable via setuptools.dep_util, removed in setuptools>=70. When the grading env has a too-new setuptools the rebuild + conftest import fail silently and pytest collects nothing -> every FAIL_TO_PASS marked failed even when the fix is correct (astropy-12907's correct fix was scored 0). Prepend a guard to /eval.sh: activate testbed, set PIP_CONSTRAINT, and pip install setuptools<70 only when dep_util is missing (no-op otherwise). Verified: 6/6 test_separable pass.
…ponses The hard-block only catches repeated identical tool calls. When the model degenerates into text-only responses (no tool call) - each answered with 'Sending a message is not allowed' - it loops forever. Cap consecutive no-action responses (_max_consecutive_messages=5) and end the session.
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.
What
First-class support for running exgentic evaluations inside a Kubernetes cluster, so the eval lifecycle no longer has to live on a laptop driving a remote endpoint over port-forward. vLLM (or any model endpoint) becomes just another in-cluster Service. Two small, orthogonal pieces - neither needs privileged:
1.
KubernetesRunner(runner="kubernetes")A cloud-native sibling of
DockerRunner.with_runner(cls, runner="kubernetes", ...)creates a ConfigMap + Pod + ClusterIP Service runningexgentic serve, waits for/health, and returns the sameObjectProxyover the sameHTTPTransport- nothing in the programming model changes; the object just lives in a Pod.kubectl applyas JSON, so it adds no dependency (no PyYAML, no kubernetes client).<svc>.<ns>.svc.cluster.local) when the orchestrator runs in-cluster, orkubectl port-forwardfrom a laptop (port_forward=True).RunnerName, settings (EXGENTIC_KUBERNETES_*),runner_mixin. Per-instance teardown andimagePullSecretsincluded.2. Pod-native SWE-bench sandbox (
SWEBENCH_SANDBOX=kubernetes)A docker-free, non-privileged backend for SWE-bench. Each task's environment becomes its own Pod, built from the SWE-bench instance image:
KubernetesEnvironmentmirrors minisweagent'sDockerEnvironment(docker exec->kubectl exec), so the agent loop is unchanged - the only contract isexecute(command, cwd) -> {"output", "returncode"}.make_test_spec(...).eval_script) inside the same Pod and parses with SWE-bench's ownget_eval_report- same tests, same parser, justkubectl execinstead of the docker harness.anyuidSCC: no privileged, no DinD, no docker socket. Each per-task Session is its own Pod (clean isolation, natural parallelism).Why
Running a large batch of SWE-bench experiments, I needed the orchestrator + agents to run in-cluster rather than on a laptop: VPN / port-forward drops were surfacing as model-server 5xx and killing long runs. This keeps the whole run in the cluster.
Testing
KubernetesRunnerround-trip validated live on OpenShift: manifest ->exgentic serve->/health-> transport call -> cleanup (trivialCalculator, withimagePullSecretspull and per-instance teardown).Out of scope (follow-up)
A generalized non-privileged Pod sandbox backend for arbitrary
docker_socket=Truebenchmarks (beyond SWE-bench).