Repository: UKGovernmentBEIS/inspect_ai
Issue: [regression] scorer metadata can no longer include a dataclass
Root cause: Algorithmic Error

## Reproducing code

```python
from dataclasses import dataclass

from inspect_ai import Task, task
from inspect_ai.dataset import MemoryDataset, Sample
from inspect_ai.scorer import Score, Scorer, Target, mean, scorer
from inspect_ai.solver import TaskState


@dataclass
class Foo:
    foo: bool


@scorer(metrics=[mean()])
def dataclass_scorer() -> Scorer:
    async def score(state: TaskState, target: Target) -> Score:
        return Score(value=1, metadata={"foo": Foo(foo=True)})

    return score


@task
def mytask():
    return Task(
        dataset=MemoryDataset([Sample(input="")]),
        plan=[],
        scorer=dataclass_scorer(),
    )
```

## Output (inspect 0.3.34)
```
┌───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────┐
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/_eval/task/run.py:270 in         │
│ task_run                                                                                                             │
│                                                                                                                      │
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/_eval/task/results.py:63 in      │
│ eval_results                                                                                                         │
│                                                                                                                      │
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/_eval/task/results.py:288 in     │
│ reduce_scores                                                                                                        │
│                                                                                                                      │
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/scorer/_reducer/reducer.py:50 in │
│ reduce                                                                                                               │
│                                                                                                                      │
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/scorer/_reducer/reducer.py:291   │
│ in _compute_scalar_stat                                                                                              │
│                                                                                                                      │
│ /Users/rusheb/miniconda3/envs/inspect-evals/lib/python3.12/site-packages/inspect_ai/scorer/_reducer/reducer.py:336   │
│ in _reduced_score                                                                                                    │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
TypeError: unhashable type: 'Foo'
```

## Output (inspect 0.3.32)
```
❯ inspect eval scratch.py
╭─ mytask (1 sample): openai/gpt-3.5-turbo ───────────────────────────────────────────────────────────────────────╮
│                                                                                              dataset: (samples) │
│ total time:                  0:00:00                                                   scorer: dataclass_scorer │
│                                                                                                                 │
│ mean: 1.0                                                                                                       │
│                                                                                                                 │
│ Log: logs/2024-10-01T10-27-29+01-00_mytask_4mobAjNsSEoRiiXy3Jk2bw.json                                          │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

## Notes:
* It looks like this was introduced by #577 
* This breaks some of our existing tasks, preventing us from upgrading
* I could work around this by 
     1. setting `frozen=true` on my dataclass (but then the dataclass would be immutable)
     2. or casting the dataclass to a dict (but this introduces boilerplate)