Repository navigation
Run split harnesses on Prime VMs beside the workspace #2803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
+506
−34
Open
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d4ea61d
Run split harnesses on Prime VMs beside the workspace
hallerite 36eed72
Tie execution worker readiness to the worker's own socket
hallerite 3130462
Let a split harness reach tool servers in task services
hallerite 3550aa0
Act only on the launched worker when joining and stopping it
hallerite a8f8e63
Run split deployment in CI for every harness that supports it
hallerite 8792379
Replace the execution worker's cgroup with an environment marker
hallerite 8528fbf
Pin nano-rlm to its split-execution head
hallerite 1ad0c8c
Treat an execution worker that exited as not started
hallerite 4c1fc8a
Pin nano-rlm to its split-execution head
hallerite 4a9c28a
Drop the execution worker's unit test
hallerite 66a38d9
Leave daemons running when a split RLM worker closes
hallerite e4b0ab1
Pin nano-rlm to its split-execution merge
hallerite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| """Check that a split harness's tools act on the workspace, not the harness's VM.""" | ||
|
|
||
| import json | ||
|
|
||
| import verifiers.v1 as vf | ||
|
|
||
|
|
||
| class SplitExecutionTask(vf.Task): | ||
| def runtime_env(self) -> dict[str, str]: | ||
| return {"VF_WORKSPACE_PROBE": "workspace-value"} | ||
|
|
||
| async def setup(self, runtime: vf.Runtime) -> None: | ||
| await runtime.write("input.txt", b"workspace-only-input") | ||
|
|
||
| @vf.reward | ||
| async def workspace_files(self, runtime: vf.Runtime, trace: vf.Trace) -> float: | ||
| report = json.loads((await runtime.read("answer.json")).decode()) | ||
| patched = (await runtime.read("patched.txt")).decode().strip() | ||
| trace.info["workspace_report"] = report | ||
| return float( | ||
| report | ||
| == { | ||
| "cwd": runtime.config.workdir, | ||
| "input": "workspace-only-input", | ||
| "env": "workspace-value", | ||
| } | ||
| and patched == "patched-remotely" | ||
| ) | ||
|
|
||
|
|
||
| class SplitExecutionTaskset(vf.Taskset[SplitExecutionTask, vf.TasksetConfig]): | ||
| def load(self) -> list[SplitExecutionTask]: | ||
| prompt = ( | ||
| "Use your shell tool to read input.txt, your current directory, and the " | ||
| "VF_WORKSPACE_PROBE environment variable. Write these actual values to " | ||
| "answer.json with keys input, cwd, env. Use your file editing tool to " | ||
| "create patched.txt containing patched-remotely. Then finish." | ||
| ) | ||
| return [SplitExecutionTask(vf.TaskData(idx=0, prompt=prompt), self.config.task)] | ||
|
|
||
|
|
||
| __all__ = ["SplitExecutionTaskset"] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """Split deployment: the harness on a Prime VM of its own, its tools in the workspace, | ||
| for every harness that declares `SUPPORTS_SPLIT_EXECUTION`.""" | ||
|
|
||
| import pytest | ||
| from grid import grid | ||
|
|
||
| import verifiers.v1 as vf | ||
| from verifiers.v1.rollout import Rollout | ||
|
|
||
| SPLIT = { | ||
| "deployment": {"mode": "split"}, | ||
| "timeout": {"setup": 900, "rollout": 300, "scoring": 60}, | ||
| } | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("entrypoint", ["run", "interaction"]) | ||
| async def test_split_preflight_before_rollout(monkeypatch, entrypoint): | ||
| """Both public execution paths reject an unsupported harness before any boot.""" | ||
|
|
||
| async def unexpected_open(self): | ||
| pytest.fail("unsupported split configuration reached rollout provisioning") | ||
|
|
||
| monkeypatch.setattr(Rollout, "open", unexpected_open) | ||
| agent = vf.Agent( | ||
| vf.AgentConfig( | ||
| model="unused", | ||
| harness={"id": "bash"}, | ||
| runtime={"type": "prime"}, | ||
| deployment={"mode": "split"}, | ||
| ) | ||
| ) | ||
| task = vf.Task(vf.TaskData(prompt="unused")) | ||
| with pytest.raises(ValueError, match="does not support split deployment"): | ||
| if entrypoint == "run": | ||
| await agent.run(task) | ||
| else: | ||
| async with agent.interaction(task): | ||
| pytest.fail("unsupported interaction was opened") | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "harness,harness_runtime", grid(needs=("shell", "split")), indirect=True | ||
| ) | ||
| async def test_split_execution(run, harness, harness_runtime): | ||
| """The agent loop runs on the harness's VM; its tools act on the workspace's files, | ||
| working directory and environment over the rollout's private network.""" | ||
| (episode,) = await run( | ||
| "split-execution-v1", | ||
| harness=harness, | ||
| runtime={**harness_runtime, "workdir": "/workspace"}, | ||
| env={"agent": SPLIT}, | ||
| max_turns=10, | ||
| max_tokens=8192, | ||
| ) | ||
| (trace,) = episode.traces | ||
| assert not trace.errors | ||
| assert trace.agent.runtime.type == trace.agent.harness_runtime.type == "prime" | ||
| assert trace.agent.runtime.id != trace.agent.harness_runtime.id | ||
| assert trace.reward == 1.0, trace.info.get("workspace_report") |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.