Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions tests/integration/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down