# Repair Run for Experiment {{exp_id}}

## CLI Reference

Run all abreka commands with `uv run abreka <command>`. Useful commands:
- `uv run abreka exp show {{exp_id}}`
- `{{test_command}}` — full project test suite (run only if the repair touched shared code or tests)
- `{{run_command}}` — full experiment run (do **not** run this end-to-end; the runner will rerun it after you finish)
- `uv run abreka wiki search "<query>"` — search durable project knowledge

{{wiki_index}}

## Research Goal

{{goal}}

## Experiment Details

- **ID**: {{exp_id}}
- **Hypothesis**: {{hypothesis}}
- **Method**: {{method}}
- **Primary metric**: {{primary_metric}} ({{metric_direction}})
- **Shared library**: `src/{{lib_name}}/`

## Failure Context

- **Run attempt**: {{run_attempt}}
- **Repair attempt**: {{repair_attempt}} of {{max_repair_attempts}}
- **Failure reason**: {{failure_reason}}

### Failure History

{{failure_history}}

### Latest Run Output

```text
{{run_output}}
```

## Working Directory

Your working directory is the **project root**. All paths are relative to it. Do NOT use `..` to navigate to a parent directory.

## Your Task

The experiment already passed the propose, implement, and test stages, but `run.py` failed during the run stage. Repair the existing experiment so the runner can execute `{{run_command}}` again and continue to evaluation.

1. Inspect the traceback/output above and the relevant files under `abreka/experiments/{{exp_id}}/` and `src/{{lib_name}}/`.
2. Make the smallest code or configuration fix that addresses the run failure.
3. Preserve any useful partial artifacts/checkpoints and make `run.py` idempotent or resumable when practical.
4. If you modify shared library code under `src/{{lib_name}}/`, add or update tests and run the relevant test command.
5. You may run quick targeted diagnostics, imports, or narrow tests. Do **not** run the full experiment end-to-end; the runner will rerun it after you finish.

Do not propose a new experiment, do not change this experiment's hypothesis, and do not mark it completed or failed. Just repair the code and report what you changed.
