# Repair a small repository

The sample has one defect: `add` subtracts. The coding session imports only its
committed `package/` directory, runs commands in a separate workspace, and exports
a patch with the original receipts. The source checkout stays unchanged.

Use Linux, Chio, Python 3.11+, uv, and the runtime profile described in
`operator/README.md`. Before starting, that setup must supply installed images,
`runtime.json`, and your selected `provider.json`. Start in `coding/`:

```sh
uv sync
git -C sample init
git -C sample add package
git -C sample commit -m "Add calculator exercise"
```

Git uses your configured author identity. The example selects `HEAD`; initialization
resolves it to the exact committed revision. Uncommitted source edits are not input.

```sh
uv run chio-mini-swe session init --config session.json \
  --task-file issue.md --state .session
```

Review `.session/provisioning-request.json` and complete the explicit operator
handoff in `operator/README.md`. It returns signed launch policies and pinned
signer keys in `authorization.json`. Then:

```sh
uv run chio-mini-swe session prepare --state .session \
  --authorization authorization.json
uv run chio-mini-swe session run --state .session
uv run chio-mini-swe session status --state .session
uv run chio-mini-swe session result --state .session --out result
```

Inspect `result/repository/changes.patch`. A recipient separately selects the source
revision, allowed paths, and trusted kernel key before verifying the export. Test
the patch in an independent checkout; do not infer code correctness from signatures.

If the host stops, retain `.session`. `session recover` reconciles owned repository
resources without restarting uncertain model requests or erasing unknown effects.
Resume with the same session; choose fresh state for a new task or changed input.

## Qualification

`qualify_session.py` runs a scripted HTTP provider through the actual session and
Docker service. It checks source preservation, timeout behavior, signed exports,
and independent patch verification. `qualify_repository.py` exercises failures
inside the repository service. They consume an explicit installed image record;
see `operator/README.md` for the distinction between setup and artifact qualification.
