FormulaCode pipeline overview¶
This page describes how one FormulaCode task goes from a merged pull request to an approved task that agents and RL training use. The work spans five repositories. This repository (datasmith) holds the steps up to review and release.
| Repository | What it does in the pipeline |
|---|---|
| formula-code/datasmith | Collects PRs, renders problem texts and builds environment images (fc-data), renders Harbor task folders (fc-render-tasks), builds task images (fc-build-tasks), and prechecks and measures tasks (fc-measure) |
| formula-code/lsv | The fork of asv that selects the benchmarks a patch affects and times them |
| formula-code/snapshot-tester | Records benchmark outputs and checks that a patch did not change them |
| formula-code/harbor | Runs trials: starts the task container, runs the agent, then runs the task's tests/test.sh |
| formula-code/formulacode-verified-rl | Runs the survey (measure, review), keeps the approved list, runs agent trials and the RL recipe |
| formula-code/skyrl | The RL trainer |
The steps¶
flowchart TD
A["collect, problem text, environment image<br/>fc-data"] --> B["records<br/>fc-render-tasks export --from-db"]
B --> C["render<br/>fc-render-tasks render<br/>(template tag)"]
C --> D["build<br/>fc-build-tasks"]
D --> E["pin<br/>fc-render-tasks render --images"]
E --> F["precheck<br/>fc-measure precheck<br/>coverage, base edits, patch applies"]
F --> G["measure<br/>fc-measure measure<br/>3 oracle + 3 no-change runs,<br/>paired A-B-B-A, host lock folder"]
G --> H["classify, review, release<br/>formulacode-verified-rl"]
H --> I["Phase 2 agent trials and RL training<br/>formulacode-verified-rl, skyrl, harbor"]
- Collect.
fc-datacollects performance PRs into the task database. Itsrender_problemsstage usesRenderShortProblemsRunner, which writes a short problem text that describes only the symptom. It does not store a text that names benchmarks, PR or issue links, code, a diff or internal code the patch changes. Its image stages build the environment image at the base commit. - Records.
fc-render-tasks export --from-db --ids-file IDS --out records.jsonlwrites one render record perowner/repo#Nfrom the task database. - Render.
fc-render-tasks render --records records.jsonl --out TASKS_ROOTwrites one Harbor task folder per record fromsrc/datasmith/harbor_adapter/template/. Render from a template tag, so every task of a release has the same test scripts. Each folder getsrender_stamp.json;fc-render-tasks checkfinds folders that no longer match the installed template. - Build.
fc-build-tasks TASKS_ROOT OUTbuilds and checks one image per task from itsenvironment/folder. The image tag is a digest of that folder. Each result is a row inOUT/manifest.jsonl; a failure is a row inOUT/failures.jsonl. - Pin.
fc-render-tasks render ... --force --images OUT/manifest.jsonlrenders again and writesdocker_imageintask.tomlwhen the task's last verified image has the sameenvironment/digest. - Precheck.
fc-measure precheck TASKS_ROOT TASKloads the image build check from the database: does the oracle patch apply, did the image already contain part of it, and does LSV select at least one benchmark (through a dependency on a changed file, or always affected). A task that fails ends asuncovered,base_editedorpatch_failedand is not timed. A task whose only selected benchmarks are always affected, and of which the build check timed none, ends asno_measurement: the suite does not run in the image. - Measure.
fc-measure measure TASKS_ROOT OUT TASKruns one Harbor job per task: 3 oracle runs and 3 no-change runs. Each run times the base and the patched code in one container in the order A-B-B-A. Each timing step takes a slot file of the host lock folder (FC_MEASURE_LOCK_DIR,FC_MEASURE_LOCK_SLOTSfiles), because timing is sensitive to memory bandwidth.--time-limit Sstops a job afterSseconds and ends the task astoo_slow. The result isOUT/oracle/<task>.json. - Classify, review and release. formulacode-verified-rl applies the noise rule
(
src/datasmith/measurement/noise.py). All values are natural-log speedups. For each benchmark $b$, the no-change runs give a spread $\sigma_b$ (pooled with the repo's spread), and the threshold is $\theta_b = \mathrm{clip}(k\sigma_b, \theta_{\min}, \theta_{\max})$ with $k = 2$. A benchmark is up when at least 2 of the 3 oracle runs are above $+\theta_b$, and down when at least 2 are below $-\theta_b$. The user then reviews each measured task, and approved gold prompts are applied there (apply_gold_prompt.py). - Agent trials and RL training. formulacode-verified-rl runs agents on the approved tasks (Phase 2) and trains
with skyrl. Trials run on Harbor with the same task folders and images, and mount the same lock folder at
/fc-measure-lock.
What "approved" means¶
A task is approved when it was measured and the user approved it after reading its per-benchmark table. Only the
user approves. The automatic rules only mark tasks not_approved, and they never change a row that has a decision.
The approved list is verified_survey/approved.csv in formulacode-verified-rl. Each row gives the task, its pinned
image, the render and template commits, the CPU models of the runs, the license and the PR author.
Rebuild one task¶
echo "- owner/repo#N" > ids.md
git -C datasmith checkout template-v1.4 # render with the release template
fc-render-tasks export --from-db --ids-file ids.md --out records.jsonl
fc-render-tasks render --records records.jsonl --out tasks/ --cpus 2 --memory 16G --storage 20G
fc-build-tasks tasks/ images/ --ids-file ids.md
fc-render-tasks render --records records.jsonl --out tasks/ --force --images images/manifest.jsonl
fc-measure precheck tasks/ owner/repo#N
fc-measure measure tasks/ out/ owner/repo#N --time-limit 21600
The survey pipeline in formulacode-verified-rl (verified_survey/pipeline.py, see verified_survey/README.md) runs
the precheck and measure steps for many tasks at once and keeps the review decisions.
Branches and pins¶
| Repository | Branch or commit | Where it is set |
|---|---|---|
| datasmith | main; release template on release/template-v1 (tags template-v1 to template-v1.4) |
the tag you render from |
| lsv | main at 68a548f |
LSV_REF in harbor_adapter/template/environment/Dockerfile and docker/templates/docker_build_final.sh |
| snapshot-tester | f08bb0c |
SNAPSHOT_TESTER_REF in the same two files |
| harbor | formulacode/harbor-reliability |
the harbor checkout that runs trials |
| skyrl | main |
the trainer checkout |
| formulacode-verified-rl | main |
the survey and recipe checkout |