Union trait does not handle trait metadata correctly
Union trait does not handle trait metadata correctly: a task in swe-rebench-v2.1-rl-isolated-1k: SWE-rebench V2.1 RL, isolated grading (1k subset) (Harbor dataset). This can be harmful if you have a Union of traits with different to json for example.
The task
This can be harmful if you have a `Union` of traits with different `to_json` for example.