Repository: UKGovernmentBEIS/inspect_ai
Issue: With `eval-set`, Docker tasks fail with `ContextVar` `LookupError` on first attempt
Root cause: Resource Mishandling

I'm seeing tasks with a Docker sandbox (e.g. `humaneval`, `mbpp`) fail on first attempt when invoked together with other tasks in `eval-set`. This only happens if the sandbox task is not listed first in the list of tasks for eval-set. The tasks then succeed on first retry. Suggests to me an initialization issue where the necessary Docker context is not being set up correctly if a task without sandbox is listed first.

To reproduce (needs [inspect_eval](https://github.com/UKGovernmentBEIS/inspect_evals)):
```
# Failing example
uv run inspect eval-set inspect_evals/bbq inspect_evals/humaneval --log-dir temp --model hf/HuggingFaceTB/SmolLM2-135M-Instruct --limit 3

# Working example
uv run inspect eval-set inspect_evals/humaneval inspect_evals/bbq --log-dir temp --model hf/HuggingFaceTB/SmolLM2-135M-Instruct --limit 3
```
This LookupError occurs during the first attempt of the humaneval task in the failing case:
```
╭──────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────╮
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_eval/task/run.py:362 in task_run              │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_util/_async.py:74 in tg_collect               │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_util/_async.py:62 in run_task                 │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_eval/task/run.py:332 in run_sample            │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_eval/task/run.py:986 in task_run_sample       │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_eval/task/run.py:680 in task_run_sample       │
│                                                                                                                    │
│ /usr/lib/python3.10/contextlib.py:199 in __aenter__                                                                │
│                                                                                                                    │
│   196 │   │   # they are only needed for recreation, which is not possible anymore                                 │
│   197 │   │   del self.args, self.kwds, self.func                                                                  │
│   198 │   │   try:                                                                                                 │
│ ❱ 199 │   │   │   return await anext(self.gen)                                                                     │
│   200 │   │   except StopAsyncIteration:                                                                           │
│   201 │   │   │   raise RuntimeError("generator didn't yield") from None                                           │
│   202                                                                                                              │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/_eval/task/sandbox.py:97 in sandboxenv_context │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/util/_sandbox/context.py:152 in                │
│ init_sandbox_environments_sample                                                                                   │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/util/_sandbox/docker/docker.py:181 in          │
│ sample_init                                                                                                        │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/util/_sandbox/docker/cleanup.py:28 in          │
│ project_startup                                                                                                    │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/util/_sandbox/docker/cleanup.py:33 in          │
│ project_record_auto_compose                                                                                        │
│                                                                                                                    │
│ /home/hehlif/compl-ai/.venv/lib/python3.10/site-packages/inspect_ai/util/_sandbox/docker/cleanup.py:148 in         │
│ auto_compose_files                                                                                                 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
LookupError: <ContextVar name='docker_auto_compose_files' at 0x70ef1c7f7a10>
```