{"slug": "generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake", "title": "Generate coding tasks. Prove the grader can catch a believable mistake.", "summary": "Coding Task Lab, a project that builds reproducible coding challenges from real repositories, released a toolchain that generates tasks from pinned Git checkouts and verifies each grader before it is used to evaluate coding agents. The lab's checks confirm the reference implementation passes, unchanged code fails the new requirements, and plausible wrong implementations fail a specific check; in a Click-based alias task, each reference passed 11/11 checks on its own contract but only 10/11 on the swapped one. The setup runs on Python 3.12+ with a local verifier that needs no Docker or model API key, and an optional Harbor-based Docker path runs oracle and nop baselines.", "body_md": "Coding Task Lab builds reproducible coding challenges from real repositories. Each challenge has a feature request, a reference implementation, and a grader. Before using a task to evaluate a coding agent, the lab checks that the reference passes, unchanged code fails the new requirements, and plausible wrong implementations fail a specific check.\n\nBoth alias tasks receive `--mode DEPLOY`, but the alias points to a different choice than the canonical `deploy` value:\n\n| Contract | Expected behavior | What happens if you swap in the other reference? | \n|---|---|---|\n| Canonical choice wins | Return `deploy` | The collision check fails | \n| Reject a conflicting alias | Exit with code `2` | The collision check fails | \n\nThe two tasks share the same inputs. Each reference passes **11/11** checks on its own contract and **10/11** on the other. The swapped implementation still earns partial credit, but it does not solve the task. The grader tells you which rule it missed.\n\nUse **Python 3.12+** and **Git**. The first run needs GitHub access to fetch Click unless you already have a verified checkout or snapshot. The local verifier does not require Docker or a model API key.\n\n```\npython3.12 -m venv .venv\n.venv/bin/python -m pip install pytest==8.4.2\n.venv/bin/python workspace.py\n```\n\nOpen [http://127.0.0.1:8765](http://127.0.0.1:8765) for the showcase. Choose **Run the lab → New run → Local verifier → Start evaluation**. Open a task and select **Evidence** to see what the wrong implementations got wrong. **Export run** downloads the task packages and the evidence for a completed run.\n\nA source-only Git checkout starts without saved runs. The distributed submission archive includes the recorded sample. `workspace.py --snapshot /path/to/click-source` lets you use an offline source snapshot that matches the checked-in [blob manifest](//evidence/click-baseline-blobs.json).\n\n```\n# Pin the upstream checkout and generate the five tasks.\n.venv/bin/python factory.py baseline\n.venv/bin/python factory.py generate --out repro --run-log repro-run.json\n\n# Run the packaged grader with the upstream pytest suite.\n.venv/bin/python verify.py --dataset repro\n\n# Test deliberate wrong patches and replay both alias policies.\n.venv/bin/python factory.py audit --dataset repro --click-source .upstream/click/src/click\n.venv/bin/python replay_alias.py --dataset repro\n```\n\nTo show reproducibility, generate again into `repro-repeat` and run `diff -r repro repro-repeat`. With identical inputs, the package files should match. To see a behavioral change, generate `--seed 43 --out fresh`: the unique-prefix contract requires **one** normalized character instead of the **three** required by seed `42`.\n\n```\n.venv/bin/python factory.py generate --seed 43 --out fresh\ndiff -u repro/pallets__click-prefix-choice-42/instruction.md \\\n  fresh/pallets__click-prefix-choice-43/instruction.md\n```\n\nUse a fresh output directory or a new seed when generating again. For the **Docker** version, start Docker with Compose and install Harbor in the same virtual environment:\n\n```\n.venv/bin/python -m pip install harbor==0.25.0\n.venv/bin/python harbor_check.py --dataset repro\n```\n\nHarbor builds the task images and runs the `oracle` (reference) and `nop` (unchanged) baselines. The job directories and aggregate `baselines.json` are saved under `jobs/`. The builds require access to GitHub, the base image registry, and Python package repositories.\n\n``` php\nflowchart LR\n    A[\"Clean checkout at a pinned Git commit\"] --> B[\"Task generator\"]\n    C[\"Task rules or repository recipe + seed\"] --> B\n    B --> D[\"Harbor package: instructions, patches, tests, Dockerfile\"]\n    D --> E[\"Local pytest or Harbor in Docker\"]\n    D --> F[\"Deliberate wrong patches\"]\n    E --> G[\"Grading details and regression results\"]\n    F --> G\n    G --> H[\"CLI reports, local workspace, and exports\"]\n```\n\n| Layer | What it uses | \n|---|---|\n| Generation | **Python** standard library (`argparse` ,`tomllib` ,`difflib` ,`random` ) and**Git** for commit checks and unified patches | \n| Grading | **pytest 8.4.2** , a test-result plugin, and explicit feature and regression test IDs | \n| Container trials | **Harbor 0.25.0** ,**Docker/Compose** , and lightweight**Bash** entry points | \n| Workspace | Python `ThreadingHTTPServer` bound to localhost, with**plain HTML, CSS, and JavaScript** ; no Node build step | \n| Automation | **GitHub Actions** regenerates the tasks twice, compares the output, and runs the Docker baselines | \n| Optional benchmark | Harbor **Terminus-2** with a configured model provider; not used to generate the tasks or reported as a model solve rate | \n\nThe Click factory checks the checkout’s origin, exact commit, and clean status before it generates patches. The Docker build checks out the same [Click 8.3.1 commit](https://github.com/pallets/click/commit/1d038f270701498433cb432f54db89f95f07a845). A representative package looks like this:\n\n```\npallets__click-alias-reject-conflict-42/\n├── instruction.md\n├── task.toml\n├── environment/Dockerfile\n├── solution/\n│   ├── patch.diff\n│   └── solve.sh\n└── tests/\n    ├── fail_to_pass.json       # new requirements\n    ├── pass_to_pass.json       # existing behaviors to preserve\n    ├── test_patch.diff\n    ├── test.sh\n    ├── grade.py\n    ├── run_script.sh\n    └── parser.py\n```\n\nThe grader applies the test patch and runs pytest. A failed regression check yields zero. Otherwise the reward is the fraction of passing feature checks; only `1.0` counts as solved. The focused wrong-patch audit is separate from the Docker baseline jobs. For the scoring internals, design choices, and trade-offs, see the [technical blog](//docs/technical-blog.md).\n\n| Task | Rule | Mistake the tests catch | \n|---|---|---|\n| Prefix choice | Accept unique normalized prefixes at the generated minimum length; exact matches win | Accept the first of two ambiguous matches | \n| Alias: canonical priority | Keep the canonical choice on a collision | Reject a valid canonical input | \n| Alias: reject conflicts | Reject collisions between different targets | Accept the conflicting input | \n| Config-first option | Prefer CLI → config → environment → default and report the actual source | Let the environment override a configured zero | \n| Fallback group | Send unknown words to a fallback without losing arguments or changing regular dispatch | Override a command that resolves after normalization | \n\n**Recorded results:** For each of the two tested seeds, all five references scored `1.0`, all five unchanged baselines scored `0.0`, and all listed regressions passed in Docker. A separate focused audit caught **15/15 deliberate wrong patches per seed**. These figures measure validator behavior on the tested tasks, not model performance or coverage of all possible mistakes. Raw results and videos are local submission artifacts, excluded from Git; the commands above regenerate the evidence.\n\nStart with the MarkupSafe example:\n\n```\n.venv/bin/python portable.py recipes/markupsafe \\\n  --check output/portable/markupsafe-replay.json\nreference        5/5 checks   reward=1.00\nno-change        0/5 checks   reward=0.00\nbelievable-error 4/5 checks   reward=0.80\n```\n\nThe last implementation incorrectly escapes an already formatted value. You can see the behavior test in [`recipes/markupsafe/checks.py`](//recipes/markupsafe/checks.py). To create another recipe:\n\n`owner/repo`, full commit SHA, task slug, and upstream license in `recipe.toml`.` instruction.md` and `checks.py`. In the recipe, list the new pytest node IDs and the existing node IDs that must keep passing.`reference.py` and an insertion anchor, or a `solution.diff` for a multi-file change. Describe one plausible wrong edit in `[wrong_patch]`.` portable.py` against a trusted recipe. Use a custom `Dockerfile` and `run_script.sh` if the project needs a different setup from `src/` imports and pytest under `tests/`. The runner must load the bundled parser and record the configured pytest IDs.\nThe current adapter targets **Python/pytest GitHub repositories**. A recipe author supplies the feature and expected behavior. The tooling packages changes and checks them against the repository; it does not discover requirements from a GitHub URL. Other languages need a verifier adapter.\n\n```\n   git clone https://github.com/YOUR_HANDLE/YOUR_FORK.git coding-task-lab\n   cd coding-task-lab\n   git switch -c feature/new-task-recipe\n```\n\n`factory.py` and `templates/` for Click task changes or `recipes/` for adding a repository.\n\nCode & more: [https://www.dailybuild.xyz/project/336-coding-task-lab](https://www.dailybuild.xyz/project/336-coding-task-lab)", "url": "https://wpnews.pro/news/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake", "canonical_source": "https://dev.to/harishkotra/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake-3bmd", "published_at": "2026-12-06 18:09:07+00:00", "updated_at": "2026-12-06 18:14:40.587671+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "ai-research"], "entities": ["Coding Task Lab", "Click", "Harbor", "Python", "GitHub", "pytest"], "also_reported_by": [], "takeaway": "A grader is only trustworthy if the reference passes all checks, unchanged code fails, and a swapped-in plausible implementation loses exactly one specific check (11/11 versus 10/11 in the Click alias task).", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake", "markdown": "https://wpnews.pro/news/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake.md", "text": "https://wpnews.pro/news/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake.txt", "jsonld": "https://wpnews.pro/news/generate-coding-tasks-prove-the-grader-can-catch-a-believable-mistake.jsonld"}}