Log inStart free
LESSON 24.05 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Repository environments: build, test and repair

Watch five patches to one bug meet three graders, and see which ones earn reward.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 24.05 · REPO BAYEDIT TEST · EXIT 1 → 0 · CLAIM: FIXED
01
Stage 1 of 6 · The workspace
The environment is a repository with a terminal. The agent edits tests/test_stats.py and reruns pytest.
Explain it simply

You see the agent's world: the files and a terminal. Each command the agent types is one action. The printed text and the exit code, a number where 0 means success, are what it observes. Here the second run exits 0, and the agent says it fixed the bug.

A file tree and a terminal. pytest first reports 1 failed, 3 passed. The agent edits tests/test_stats.py. pytest then reports 4 passed, exit 0.

workspace, inputstoolchain, hardware, trusted copyfailures, editsreward, results
workspace filessrc/stats.pytests/test_stats.pyMreport.pypyproject.tomlagentcommandtext, exit code$ pytest -qF... 1 failed, 3 passedexit 1$ edit tests/test_stats.py- assert median([1, 2, 3, 4]) == 2.5+ assert median([1, 2, 3, 4]) == 3$ pytest -q.... 4 passedexit 0agent: "Fixed. All tests pass."reward per patch, by gradertrusted grader: not run yetclaimteststrustedhonest fixhardcodeedit testmute errorsdrop sort11111the repository environmentworkspace filessrc/stats.pytests/test_stats.pyMreport.pypyproject.tomlagentcommandtext, exit code$ pytest -qF... 1 failed, 3 passedexit 1$ edit tests/test_stats.py- assert median([1, 2, 3, 4]) == 2.5+ assert median([1, 2, 3, 4]) == 3$ pytest -q.... 4 passedexit 0agent: "Fixed. All tests pass."reward per patch, by gradertrusted grader: not run yetclaimteststrustedhonest fixhardcodeedit testmute errorsdrop sort11111the repository environment
Toy: 5 files, 5 patches, 40 random lists
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
st+1=run(st,at),ot=(stdout,exit)s_{t+1} = \text{run}(s_t, \sy{a}{data}{a_t}),\quad o_t = (\text{stdout}, \sy{e}{out}{\text{exit}})
at=pytest -q,exit=0a_t = \texttt{pytest -q},\quad \text{exit} = 0

Each command changes the workspace and returns text and an exit code.

Common mix-ups

MYTHTests that pass in the agent's workspace prove the fix.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01The hardcode patch passes all 4 workspace tests. Does the trusted grader pay it?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.