Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
1cce5b4 to
d6eb57c
Compare
d6eb57c to
3dee913
Compare
3dee913 to
d1d9fd7
Compare
d1d9fd7 to
63d20d5
Compare
9d3bf88 to
0e7a924
Compare
0e7a924 to
8e9421b
Compare
8e9421b to
055a802
Compare
marta-sd
left a comment
There was a problem hiding this comment.
LGTM, added some minor clarifying questions
|
|
||
| def setup_webserver(self) -> FastAPI: | ||
| app = super().setup_webserver() | ||
| app.post("/close_session")(self.close_session) |
There was a problem hiding this comment.
Shouldn't we add it to the base class with abstract self.close_session?
| print( | ||
| f"Failed to setup anti-cheating for {body.instance_id}. Return code: {result.return_code}\n" | ||
| f"Stdout:\n{result.stdout}\nStderr:\n{result.stderr}" | ||
| await previous.stop() |
There was a problem hiding this comment.
To make sure I understand correctly: we're removing the try-except block to capture the failures on the env server side?
| await self.normalize_sandbox_environment(sandbox, body.instance_id) | ||
| self._session_id_to_pristine_untracked[session_id] = await self.pristine_untracked_files(sandbox) | ||
| if result.return_code != 0: | ||
| print( |
There was a problem hiding this comment.
And here we keep the old behavior - print and move on if this fails?
| ) -> SWEBenchProSeedSessionResponse: | ||
| self, | ||
| request: Request, | ||
| body: SWEBenchProSeedSessionRequest | ResourcesSeedSessionRequest, |
There was a problem hiding this comment.
Should be deprecate the SWEBenchProSeedSessionRequest + SWEBenchProSeedSessionResponse path?
| async def verify( | ||
| self, | ||
| request: Request, | ||
| body: SWEBenchProVerifyRequest | ResponsesResourcesVerifyRequest, |
There was a problem hiding this comment.
Same here: should we deprecate SWEBenchProVerifyRequest?
| raise ValueError("resources_session_id does not match the session cookie") | ||
| identity = self._session_id_to_identity.get(session_id) | ||
| if identity is None: | ||
| raise ValueError(f"Unknown resources session: {session_id}") |
There was a problem hiding this comment.
Closing the same session twice returns 200 then 500 (Unknown resources session). If a close succeeds but its response is lost, the transport retry turns an otherwise successful episode into a cleanup failure. Could repeated closes for the same episode succeed while retaining identity checks?
| await sandbox.stop() | ||
| raise | ||
|
|
||
| self._session_id_to_task[session_id] = task |
There was a problem hiding this comment.
This also retains task data for legacy seed calls, but legacy /verify never removes it and legacy callers do not call /close_session. I reproduced a successful seed/verify leaving the full task cached after the sandbox was released, so memory grows with completed sessions. Could we store this only for native sessions?
Signed-off-by: Ananth Subramaniam <[email protected]>
|
Closing to recreate the remaining Environment Server work as one correctly ordered GitHub Stack. Branch commits are preserved; a replacement PR will follow. |
What does this PR do?
Adds native session support to SWE-bench Pro while preserving its legacy request shapes. The Resources Server owns task sandbox setup, verification, and cleanup.
Single-agent interaction flow
This diagram shows the built-in single-agent use case. Other Environment Server protocols may coordinate different participants and use different request, result, and lifecycle flows.
sequenceDiagram participant C as Rollout collector participant E as Environment Server participant R as Task / Resources Server participant A as Agent Server participant M as Model Server participant S as Task sandbox C->>E: POST /run E->>R: Seed task session R-->>E: Tool access and optional SandboxAccess E->>A: Seed agent session A->>S: Connect as borrower when supplied E->>A: Invoke /v1/responses A->>M: Model and capture requests A-->>E: Agent response E->>A: Close agent session E->>R: Verify response E->>R: Close task session E-->>C: Episode resultThe Environment Server coordinates ordering and the final result. Agent and Task/Resources Servers retain ownership of the state and resources they create.
This is part 9 of 13 in the Environment Server stack. Previous: #3487. Next: #3714.
Validation
uv run pytest resources_servers/swebench_pro/tests/test_app.py -qRollouts
See the final PR for end-to-end rollout evidence.
Compatibility and benchmark impact
Legacy SWE-bench Pro callers remain supported.
Repeated native verification
A native verify now fails when its task sandbox has already been consumed instead of evaluating an empty patch and returning a normal-looking reward. The regression test performs one successful native verification and confirms that the second request fails.