diff --git a/tests/integration/grid.py b/tests/integration/grid.py index b93a443bfe..4fb76ebb4a 100644 --- a/tests/integration/grid.py +++ b/tests/integration/grid.py @@ -94,8 +94,25 @@ def assert_one_branch( assert set(forks) <= FORKS.keys(), ( f"no FORKS reason for {set(forks) - FORKS.keys()}" ) - if harness.id not in forks: - assert trace.num_branches == 1, f"{trace.num_branches} branches" + if harness.id in forks or trace.num_branches == 1: + return + first_child: dict[int | None, int] = {} + for i, node in enumerate(trace.nodes): + first = first_child.setdefault(node.parent, i) + if first != i: + sibling = trace.nodes[first] + a, b = sibling.message, node.message + fields = type(a).model_fields.keys() | type(b).model_fields.keys() + changed = sorted( + k for k in fields if getattr(a, k, None) != getattr(b, k, None) + ) + if sibling.tools != node.tools: + changed.append("tools") + pytest.fail( + f"{trace.num_branches} branches at parent {node.parent}, " + f"nodes {first} ({a.role}) and {i} ({b.role}), differing fields {changed}" + ) + pytest.fail(f"{trace.num_branches} branches") def agent_seats(taskset: str, env_id: str = "") -> list[str]: