ssh
workspace while the environment keeps a clean baseline outside it, then applies the authored tests
after the agent finishes. hud init --template coding copies the project as a starting point.
Create the environment
The included
flask-4992 and flask-5063 tasks are from
SWE-bench Lite. Run them with any
coding agent that opens the environment’s shell capability:
bwrap isolation. Otherwise, build the packaged environment
and attach to its control channel:
How the grading boundary works
- Task setup clones
base_refinto an environment-owned baseline outside the workspace. - The clean worktree is copied into the
sshworkspace and initialized as a one-commit repository, so the source history and reference-fix refs are never exposed to the agent. - Grading terminates the agent’s isolated session namespace and discards its Git metadata.
- The environment restores
test_pathto the baseline and applies the hidden patch. - The custom
JUnitGraderrunstest_commandthroughBashGraderunder the workspace’s isolated UID, then scores the selected fail-to-pass and pass-to-pass test IDs.
Define a task
Callcoding_task once per repository issue and give the resulting task a stable slug:
tasks.py
test_command runs from the repository root and must write JUnit XML to {junit_path}. The default
reward is the fraction of selected tests that pass; set binary=True to require every selected test.
Adapt it to another repository
- Replace
flask.bundlewith a bundle containing the prepared baselines for your tasks. - Update
REPO_SOURCEinenv.py, or setREPO_URLfor a local run. - Install repository dependencies in
Dockerfile.hudso grading does not depend on runtime downloads. - Keep reference fixes outside the baseline history exposed to the agent; put hidden test patches in the task rows.
- Add task rows in
tasks.py; changing rows does not require changing the environment template.
environments/coding.