RL Environment Pipeline
Prepare verifiable coding tasks for TRL’s AsyncGRPOTrainer with OpenEnv. Before training on a task, confirm two things: the verifier separates valid fixes from broken checkouts, and the base model gets a mix of passes and failures so GRPO has learning signal.
- Local (CPU, no sign-in): Reproduce the 177-task shortlist from the pinned dataset revision and inspect verifier evidence on a worked example (Squirrel, a Go query builder with a mutated
UPDATEsubquery). - Optional (HF Jobs): Re-run native
openenv validatechecks in a cloud sandbox.
1. Collect and screen candidate tasks
Build a task pool from existing benchmarks and targeted synthetic generation, then filter out invalid tasks, duplicates, and evaluation overlap.
- Hub tasks (847 accepted): 490 Python and 227 Go tasks from SWE-smith (bugs injected into working repos) plus 130 SWE-Gym issue repairs from TaskTrove, screened for training eligibility, duplicates, repository caps, and eval-repo overlap.
- Tasksmith tasks (24 accepted): Generated from merged pull requests covering skills underrepresented in the Hub pool (filesystem operations, HTTP streaming, serialization). Tests are checked against four controls: the reference fix, a second valid solution, the unfixed code, and a known-wrong change.
Note: Repository caps and eval-repo exclusions applied to the Hub selection only. Three Tasksmith tasks share the cattrs repository with DeepSWE; exclude them if you evaluate on DeepSWE.
Hub candidates
Of 1,127 SWE-smith and SWE-Gym candidates, 858 passed validation. The repository cap left 847.
Tasksmith generation
From 30 selected pull requests, Tasksmith produced 24 accepted tasks across 10 Python repositories.
final_v1. Of these, 463 had complete base-model scores. The 177 with both successful and failed attempts form final_best_v1.2. Reproduce the shortlist locally
Download prepare.py into a fresh directory and run it with Python 3.12. It verifies the published 177-task shortlist against the pinned JSONL files and downloads the Squirrel example into squirrel-task/.
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install huggingface_hub
python prepare.py
Expected output:
871 tasks, 463 scored, 177 with mixed rewards
Squirrel: 1 solved in 4 attempts
3. Check verifier quality
Inspect the downloaded task directory before admitting it to training:
squirrel-task/instruction.md: issue prompt shown to the agentsquirrel-task/solution/solve.sh: reference repairsquirrel-task/tests/: frozen Go tests restored at grading timesquirrel-task/validation/canaries/: deliberately broken or cheated submissions
prepare.py prints the per-trial rewards from the published batch validation gate:
| Trial | Reward | What it tests |
|---|---|---|
| Reference repair | 1 | The intended repair can earn full credit. |
| Reference replay | 1 | A second trial gives the same score. |
| No edit | 0 | Leaving the bug in place loses credit. |
| Original bug, deleted tests, stale reward | 0 each | These three submissions cannot collect credit. |
These controls verify that an unchanged checkout fails and that tampering with tests or reward files cannot collect credit. They do not test a plausible partial repair, such as fixing subqueries while breaking other SQL expressions. Add domain-specific partial-fix canaries when authoring new tasks.
Optional: re-run validation on Hugging Face Jobs
prepare.py pins squirrel-task/task.toml to the separately published Linux task image. To run fresh native checks (starts billable sandbox trials), sign in with a Jobs-enabled Hugging Face account and run:
python -m pip install "openenv[harbor] @ git+https://github.com/openenv/OpenEnv@ebc8ac878fbe731332ec468100300b92fe750a21"
hf auth login
openenv validate squirrel-task --sandbox hf-sandbox
The recorded native run passed manifest, startup, reward format, oracle, replay, floor-gap, and canary checks. It returned WARN because optional checks, including solution leakage, were skipped.
4. Filter tasks by base-model difficulty
A passing reference repair proves a task is solvable, not that it is useful for RL. With binary rewards, GRPO needs rollout groups containing both passes and failures to compute non-zero advantages, so drop tasks the base model solves every time or never solves.
- Scoring protocol: Run Qwen3.8-27B on the broken checkout with oracle and grading assets withheld (temperature
0.7, thinking disabled, up to 48 turns and 1,800 s per attempt, 4 or 8 valid attempts per task). Hub tasks used the pipeline’s tool-calling agent; Tasksmith used Harbor’sterminus-2agent. Provider or sandbox errors leave a task incomplete. - Results at this revision: Across 463 scored tasks (408 lack complete scores), 123 had zero solves, 163 were always solved, and 177 had mixed outcomes (including Squirrel at 1 of 4).
Each bar covers the scored tasks in one source. SWE-Gym had mixed outcomes on 27 of 37 tasks (73%). The blog figure covers 442 Hub tasks. This dataset revision also includes 21 scored Tasksmith tasks, six with mixed outcomes. Source rows
Reproduce the shortlist by keeping scored tasks with both passes and failures:
scored = [r for r in tasks if r["qwen_status"] == "scored"]
mixed = [r for r in scored if 0 < r["qwen_solved"] < r["qwen_valid_attempts"]]
- Re-score when setup changes: Four attempts give a noisy estimate of pass rate. Repeat difficulty scoring if you change the base model, tool harness, or generation budget.
- Audit status: This filter checks difficulty only. Published rows still mark training admission as
false, and corpus-wide leakage and alternative-solution audits remain open.
5. Run rollouts and capture training traces
When wiring shortlisted tasks into a TRL training loop:
- Sample a shortlisted task and start each rollout in a fresh sandbox workspace.
- Expose only the task instruction and broken source; keep the reference fix, grader, and expected rewards out of model context.
- Grade the finished edit with the trusted verifier, pass the scalar reward to the trainer, and log infrastructure failures separately rather than as zero-reward trajectories.
From a validated task to a training rollout
After admission, Harbor runs the task in the selected agent harness and the verifier grades the submission. OpenEnv records the model calls. The example below shows which evidence is available for a scored evaluation or an online RL sample. Read the capture requirements.
Verifier
Reward 1
Submission passes the tests.
Capture proxy
Training capture verified
Engine token IDs and sampled log probabilities.
Results: short-run training ablation
To measure the effect of validation and difficulty filtering, we trained four Qwen3.8-27B LoRA adapters with TRL’s AsyncGRPOTrainer, varying only how tasks were selected. Each run used 32 tasks, the opencode harness (up to 48 model calls per attempt), binary verifier rewards, and one 8× H200 job.
| Run and task selection | First five steps | Last five steps* | Checkpoint step |
|---|---|---|---|
| Unvalidated 24 accepted, 8 rejected by the gate | 63.8% | 67.1% | 40 |
| Validated 32 accepted, sampled without difficulty labels | 56.2% | 70.4% | 50 |
| Unqualified 32 accepted, all or zero attempts solved | 60.2% | 63.1% | 25 |
| Qualified 32 accepted, some attempts solved | 62.4% | 81.2% | 50 |
*The last window ends at the listed checkpoint. The unvalidated and unqualified runs timed out at steps 48 and 26. Comparing the two step-50 checkpoints, training reward rose by 18.8 percentage points on the qualified set and 14.2 points on the validated set. Measuring transfer to Terminal-Bench 2.1 requires a separate held-out evaluation.