Skip to content

feat(swe-bench): gate dispatch on endpoint readiness - #484

Open
leopck wants to merge 6 commits into
swe-dist-4-eval-classifierfrom
swe-dist-5-predispatch-gates
Open

feat(swe-bench): gate dispatch on endpoint readiness#484
leopck wants to merge 6 commits into
swe-dist-4-eval-classifierfrom
swe-dist-5-predispatch-gates

Conversation

@leopck

@leopck leopck commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Adds fail-closed pre-dispatch checks for checkpoint identity, scaled tool calling, and stable endpoint fingerprints.

Fleet execution begins only after the configured inference endpoints prove they are ready for the requested SWE-bench workload.

@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@github-actions github-actions Bot added the size/large PR Review Policy: 501-1500 lines or 21-50 files label Aug 27, 2026
Comment thread src/inference_endpoint/evaluation/swe_bench_distributed/gates.py Fixed
Comment thread src/inference_endpoint/evaluation/swe_bench_distributed/gates.py Fixed
@leopck leopck changed the title swe dist 5 predispatch gates feat(swe-bench): gate dispatch on endpoint readiness Aug 27, 2026
@leopck
leopck force-pushed the swe-dist-5-predispatch-gates branch from 8fb1c98 to fcd012a Compare August 27, 2026 15:25
@leopck
leopck force-pushed the swe-dist-5-predispatch-gates branch from fcd012a to a7013e0 Compare August 27, 2026 15:31
@leopck
leopck force-pushed the swe-dist-5-predispatch-gates branch from a7013e0 to 3bc0f3d Compare August 27, 2026 15:52
leopck added 6 commits August 27, 2026 08:57
A run against a remote engine with no endpoint credential makes zero
progress and never ends.

`SweBenchRunner._base_env()` auto-filled `OPENAI_API_KEY="EMPTY"` only when
the endpoint hostname was `localhost`, `127.0.0.1` or `::1`. For any other
host with `endpoint_api_key` unset it did the opposite: it *removed* the
variable. litellm then refuses to build the request locally --

    litellm.AuthenticationError: Missing credentials

-- mini-swe-agent classifies that as transient and retries it every 60s,
forever. Not one request reaches the engine, nothing is logged at ERROR,
the agent processes stay alive, and the run neither progresses nor
terminates. Observed on a 20-node run against a remote GB300 engine: 200
workers, 0 requests served, no failure surfaced.

The hostname gate is the defect. An unauthenticated OpenAI-compatible
server ignores the credential value whether it is reached over loopback or
over the network, so the placeholder is correct in both cases and the
distinction only ever suppressed it where it was needed most.

Replace the pop with the placeholder. The security property that motivated
the pop is kept and made explicit: an ambient `OPENAI_API_KEY` inherited
from the service host is still never forwarded to the endpoint -- it is
overwritten rather than deleted.

Tests: `test_base_env_always_supplies_a_credential_placeholder` covers
loopback and remote hosts; the existing
`test_base_env_supplies_api_key_only_to_agent_subprocess` encoded the old
behaviour and is corrected to assert the placeholder while still proving a
configured key wins and an ambient key never leaks.
run_gates() calls assert_scale() before check() and treats GateScaleError as
a gate FAILURE, never a skip. This is the code-level form of the most
expensive lesson available: a tool-call gate that exercised the right
operation at a 278-token prompt passed, while prompts over 2k tokens
silently returned empty, and the run scored 0/80.

- CheckpointIdentityGate probes /get_model_info then /v1/models and compares
  the served model path with == , never startswith or in: the bf16 path is a
  strict prefix of the fp8 path, so any substring test passes an FP8 engine
  as bf16. Unidentifiable or ambiguous endpoints fail closed.
- ToolCallGate requires a well-formed bash tool call at a prompt of at least
  min_prompt_tokens measured with the server's own /tokenize, not estimated
  from characters. No tokenizer means the gate cannot prove its scale, so it
  fails.
- EndpointFingerprintGate records a per-endpoint identity the dispatcher
  re-checks at publish time, so an engine restarted under a live client
  cannot yield a 0%-accuracy run that still exits rc=0.
EndpointFingerprintGate hashed the whole /v1/models payload. vLLM stamps that
response with a request-time `created` field and mints a fresh
`permission[].id` on every call, so two reads of one healthy, untouched engine
produce two different fingerprints -- four calls, four values.

The dispatcher records a fingerprint when a unit is claimed and re-reads it
when the unit is published, and treats any difference as `endpoint_changed`:
an infrastructure fault, which requeues the unit. With an unstable fingerprint
that comparison is always true, so every unit is retried until it exhausts
max_attempts, is published as abandoned, and the merge gate refuses the run.
The failure costs the full agent and evaluation time of every attempt first,
and reports itself as infrastructure damage rather than as a bug here.

Hash only the identity-bearing fields by dropping the per-request ones. The
gate still fails closed on an endpoint whose identity cannot be read at all,
which is the property it exists to provide.
@leopck
leopck force-pushed the swe-dist-5-predispatch-gates branch from 3bc0f3d to ad7777c Compare August 27, 2026 15:58
@leopck
leopck marked this pull request as ready for review August 27, 2026 19:50
@leopck
leopck requested a review from a team as a code owner August 27, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/large PR Review Policy: 501-1500 lines or 21-50 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant