Skip to content

task template v1: the Phase 1 template and its fixes in one branch, for one merge into main - #65

Merged
ArjunS07 merged 56 commits into
mainfrom
release/template-v1
Oct 20, 2026
Merged

ArjunS07 merged 56 commits into
mainfrom
release/template-v1

Conversation

@ArjunS07

@ArjunS07 ArjunS07 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The task template that built and measured the Phase 1 survey was on unmerged branches, so main does not build the same tasks. main also pins an lsv commit (cab3cc8) that is not on lsv main. This PR puts the whole template on one branch, so main can take it in one merge. New task builds use the tag template-v1.4 on this branch.

How it works

release/template-v1 starts at survey/phase1-template-20261008 (head of #56). Then main and the open template PRs were merged into it in stack order, as local merges. None of those PRs was merged on GitHub.

graph LR
  main --> R["release/template-v1"]
  S["survey/phase1-template-20261008"] --> R
  P62["#57, #60, #61, #62"] --> R
  P58["#58, #59, #64"] --> R
  P34["#30, #34"] --> R
Loading

Changes

  1. PRs that this branch contains. Each PR keeps its own description. All of them are closed now, with a comment that points to this PR.
PR Change
#32, #50, #52, #53, #54, #55, #56 Merged on GitHub into the template branches: git history removal, base file restore, missing benchmark dependencies, confirmation pass, skip flags, --only
#40, #41, #42, #43 In the survey branch: tests for changes to compiled sources only, sqlite3 before pandas, repo package before site-packages, check for a shadowed project
#57, #60, #61, #62 pytest runner: the base run uses the agent's arguments, leaves out new test files, uses a --basetemp in the container, and compares committed changes against the base commit
#58, #59 Prompt and verifier: edits to the measurement setup are discarded before timing
#64 LSV_REF → lsv 9702a48 (lsv#10: copy sys.modules before the extension scan), then lsv 909ec2f in change 5
#30, #34 parser.py marks reward.txt as not used for training, and the paired timing merge
  1. Env image build uses the pinned lsv and snapshot-tester (tag template-v1).

    • docker/templates/docker_build_final.sh installs lsv and snapshot-tester at the same commits as LSV_REF and SNAPSHOT_TESTER_REF.
    • Effect: environment images and task images use the same lsv.
    • Before: the installs used the latest commit of each repo.
  2. Gate lease id in the log (tag template-v1.1).

    • setup.sh and test.sh write each acquire to measure_gate.txt as <step> <lease id> 1|0.
    • Effect: a stopped job can release its gate leases.
    • Before: each acquire was written as <step> 1|0, so the leases of a stopped job stayed until their time limit.
  3. Shorter comments (tag template-v1.2).

    • Comments in parser.py, lsv_measure.py and records.py are 1 or 2 lines.
    • Effect: no change in behavior.
  4. LSV_REF → lsv 909ec2f (tag template-v1.3).

    • Effect: task images install lsv with lightspeed: a failing teardown does not stop the survey lsv#7, so a failing benchmark teardown after a failing benchmark body does not stop the coverage survey.
    • Before: template-v1.2 pinned lsv 9702a48, which stopped the survey in that case. Between the two lsv commits only survey.py (2 lines) and its test change.
  5. Measure gate is a lock folder of slot files, not the HTTP gate (tag template-v1.4).

    • The host mounts a folder with one empty file per slot into the trial. The number of files is the number of slots.
    • tests/measure_lock.sh takes a free slot with flock -n and tries again every 2 seconds. setup.sh and test.sh load it with source.
    • The slot is held around the same steps as before: lsv_init (init), lsv_measure (measure), the confirmation pass (confirm), and snapshots plus pytest (tests).
    • mg_release calls flock -u before it closes the file descriptor, so a process that the step left running does not keep the slot. The kernel also frees the slot when the trial process stops.
    • Settings: FC_MEASURE_LOCK_DIR (default /fc-measure-lock) and FC_MEASURE_LOCK_WAIT in seconds (default 7200, the same limit as the old acquire).
    • Each step writes <step> <slot file name> 1 to measure_gate.txt. A folder without slot files, or a wait past the limit, writes <step> none 0 at once or after the wait, so the readers drop the trial as ungated as before.
    • Effect: trials need no network access to the host and no token. A stopped job leaves no lease behind.
    • Before: curl called MEASURE_GATE_URL to acquire and release a lease, and a stopped job kept its leases until their time limit.
  6. FC_SKIP_LSV flag in test.sh (tag template-v1.4).

    • It is read from the incoming environment with FC_SKIP_PYTEST and FC_SKIP_SNAPSHOT, before the profile.d files are sourced.
    • When it is 1, test.sh does not run lsv_measure or the confirmation pass, and writes lsv_skipped.json.
    • parser.py then writes reward.json with lsv_skipped set, no speedups, and the pytest and snapshot results.
    • Effect: a correctness trial does not spend time on timing.
    • Before: each trial timed the patch.
  7. Precheck fields in the image build check (tag template-v1.4).

  8. LSV_REF → lsv 6858286 (tag template-v1.4).

    • lightspeed: a changed file that is not source is hashed, not parsed lsv#12 is merged. A changed file that is not source code (for example a *.prof dump that an agent leaves in the repo) is hashed, not parsed.
    • Effect: such a file does not stop the timing with "invalid or missing encoding declaration".
    • Before: lsv 909ec2f raised SyntaxError on such a file. Between the two lsv commits only process_code.py (7 lines) and a new test change.

Not included:

Usage

Render and build from the latest tag:

git -C datasmith checkout template-v1.4
fc-render-tasks render --records RECORDS.jsonl --out TASKS

Verification

Run again on the current head (0e244db, tag template-v1.2):

$ pytest -q tests --ignore=tests/integration
1809 passed, 11 skipped in 507.11s
  • The same command gave 1809 passed, 11 skipped in 1400.81s on the commit tagged template-v1.
  • environment/Dockerfile pins LSV_REF=909ec2f and SNAPSHOT_TESTER_REF=f08bb0c. The env image build script uses the same commits.

After the LSV_REF change (head 3f4bc00, tag template-v1.3): pytest -q tests/docker: 453 passed, 10 skipped.

On head 4bf55df (tag template-v1.4):

$ pytest -q tests/docker
475 passed, 10 skipped in 54.55s
$ pytest -q tests/test_overrides_wiring.py tests/agents/test_sandbox.py
87 passed
$ uv run --python 3.8 --with pytest python -m pytest -q --noconftest tests/docker/test_apply_oracle_patch.py tests/docker/test_emit_measure.py
42 passed

Notes

ArjunS07 and others added 30 commits September 29, 2026 00:53
…sts of the package that builds them

When no test maps from the changed files and the patch changes C, C++, Cython, Fortran or CUDA sources, their templates or build files, pytest_runner.py runs up to 12 test files from the nearest tests folder above them (strategy compiled_fallback). test.sh rebuilds for the same file types. A runner error is written to note instead of being dropped.
In some task images pandas loads the system libstdc++ first, and the env's libicu (needed by sqlite3, which coverage imports) then fails with CXXABI_1.3.15 not found. pytest.main raised, and the runner recorded no tests.
…py of the package in site-packages does not hide it

numpy#21464: the image has a regular numpy 1.22.3 in site-packages next to the editable repo.
The runner runs as a script, so site-packages came first; a plugin imported that numpy and the
repo's numpy/conftest.py then failed with ImportPathMismatchError (0 tests).
…on disk; fix the ref check that never failed
task image: remove git history after HEAD on the Phase 1 template branch
… install it and retry

Discovery errors name the module (No module named X, pandas optional deps, geopandas spatial index). Up to 3 rounds;
installs pin every installed version and prefer releases from before the base commit date. Folders in the repo that
ship the module (MDAnalysis testsuite) are installed editable. What was added is written to added_deps.json and
lsv_init_results.json.
…e commit before the baseline

base_restore.json lists, per task, the oracle files that the base image's build script edited
(49 of the 58 survey tasks that end base_edited). The task image restores them, rebuilds the
package, and fails the build if a file is still edited. Tasks not in the list render as before.
task template: restore files a stored build script edited, before the baseline
task image: install the modules benchmark discovery lacks and retry discovery
With tests/confirm.json, test.sh times again, in the same container and inside the measure gate, the benchmarks whose
first-pass median log speedup is beyond theta plus the oracle's improved ones. lsv_measure.py gets --only and --out.
template: confirmation pass with more paired rounds on unsure benchmarks
@ArjunS07
ArjunS07 merged commit 80a7ba4 into main Oct 20, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant