Bug-Fix Main Task Generation

Generates "fix bug" type main tasks by introducing mutations into environment codebases, then using integration test failures as task descriptions.

Quick Start

# Generate 5 bug-fix tasks for web_scraping ct run mtgen-bugfix -e web_scraping --count 5 # With auto-promote to main_tasks/ ct run mtgen-bugfix -e web_scraping --count 5 --promote

How It Works

The pipeline runs ideate (the fast model invents a realistic bug for the environment) → generate (the smart model writes a patch) → validate (in Docker, apply the patch, run the integration tests, and check that they fail) → optionally promote (copy to main_tasks/).

Expect an overall validation success rate of about 8%. Run --count 10 per environment to get 1-2 valid bugs.

Environment Support

The pipeline discovers installed environments with mtgen/bugfix.yml configs.

To add a new environment, you need:

  • mutable_paths — where the source code lives
  • integration_test_path — test file for the LLM prompt
  • docker_compose_path — compose file for validation
  • Path transformation in llm_pipeline.py for host-to-container mapping

Validation Output

OutputMeaning
VALID (breaks N tests: ...)Tests fail as expected
SETUP_FAILEDPatch doesn't apply to actual code (normal, re-run)
EVAL_ERRORDocker/sandbox issue
HANG - timed outMutation causes an infinite loop; discard
INVALID - Tests still passNo-op patch; discard
COLLECTION_ERRORTest import error in container — env setup issue