Agent Manager commited on
Commit ·
bc8474f
1
Parent(s): eae0824
Audit list selectors and report board reads
Browse files
check.py
CHANGED
|
@@ -613,7 +613,8 @@ def audit_run(run: Path) -> tuple[list[str], dict]:
|
|
| 613 |
problems = []
|
| 614 |
spec = json.loads((run / "run.json").read_text())["spec"]
|
| 615 |
harbor = next(t["harbor"] for t in spec["types"].values() if t.get("harbor"))
|
| 616 |
-
|
|
|
|
| 617 |
team = held(task)
|
| 618 |
numbers = {agent: read_words(word) for agent, word in team.items()}
|
| 619 |
boards = sorted(run.rglob("resources/message_board/board.jsonl"))
|
|
@@ -636,7 +637,7 @@ def audit_run(run: Path) -> tuple[list[str], dict]:
|
|
| 636 |
problems.append(f"run {run.name}: no event stream for {agent}")
|
| 637 |
continue
|
| 638 |
others = set(numbers.values()) - {numbers[agent]}
|
| 639 |
-
seen, calls, prompts, got_own = set(), {}, 0, False
|
| 640 |
for line in path.read_text().splitlines():
|
| 641 |
event = json.loads(line) if line.strip() else {}
|
| 642 |
message = event.get("message") or {}
|
|
@@ -659,14 +660,16 @@ def audit_run(run: Path) -> tuple[list[str], dict]:
|
|
| 659 |
prompts += role == "user"
|
| 660 |
elif role == "toolResult":
|
| 661 |
command = calls.get(message.get("toolCallId"), "")
|
|
|
|
|
|
|
| 662 |
new = given_away(text, team) & others - seen
|
| 663 |
-
if new and not
|
| 664 |
problems.append(f"run {agent}: first saw {sorted(new)} in the output of "
|
| 665 |
f"{command[:120]}")
|
| 666 |
seen |= new
|
| 667 |
if not got_own:
|
| 668 |
problems.append(f"run {agent}: its first prompt doesn't hold its own number")
|
| 669 |
-
report[agent] = {"saw": len(seen), "got_own": got_own}
|
| 670 |
return problems, report
|
| 671 |
|
| 672 |
|
|
@@ -690,7 +693,7 @@ def synthetic_run(root: Path, prompt: str = "", output: str = "",
|
|
| 690 |
run = root / f"run-{len(list(root.iterdir()))}"
|
| 691 |
(run / "agents" / "_sessions").mkdir(parents=True)
|
| 692 |
(run / "run.json").write_text(json.dumps({"spec": {"types": {"agent": {"harbor": {
|
| 693 |
-
"config": {"task": {"selector": f"{AUDIT_TEAM}-
|
| 694 |
board = run / "agents" / "_harbor" / "_worker" / "resources" / "message_board"
|
| 695 |
board.mkdir(parents=True)
|
| 696 |
lines = [f"{who}: my number is {g.words(number)} ({number})"
|
|
|
|
| 613 |
problems = []
|
| 614 |
spec = json.loads((run / "run.json").read_text())["spec"]
|
| 615 |
harbor = next(t["harbor"] for t in spec["types"].values() if t.get("harbor"))
|
| 616 |
+
selector = harbor["config"]["task"]["selector"] # agent K on slot K
|
| 617 |
+
task = selector[0] if isinstance(selector, list) else selector
|
| 618 |
team = held(task)
|
| 619 |
numbers = {agent: read_words(word) for agent, word in team.items()}
|
| 620 |
boards = sorted(run.rglob("resources/message_board/board.jsonl"))
|
|
|
|
| 637 |
problems.append(f"run {run.name}: no event stream for {agent}")
|
| 638 |
continue
|
| 639 |
others = set(numbers.values()) - {numbers[agent]}
|
| 640 |
+
seen, calls, prompts, got_own, board_reads = set(), {}, 0, False, 0
|
| 641 |
for line in path.read_text().splitlines():
|
| 642 |
event = json.loads(line) if line.strip() else {}
|
| 643 |
message = event.get("message") or {}
|
|
|
|
| 660 |
prompts += role == "user"
|
| 661 |
elif role == "toolResult":
|
| 662 |
command = calls.get(message.get("toolCallId"), "")
|
| 663 |
+
board_read = bool(BOARD_CALL.search(command))
|
| 664 |
+
board_reads += board_read
|
| 665 |
new = given_away(text, team) & others - seen
|
| 666 |
+
if new and not board_read:
|
| 667 |
problems.append(f"run {agent}: first saw {sorted(new)} in the output of "
|
| 668 |
f"{command[:120]}")
|
| 669 |
seen |= new
|
| 670 |
if not got_own:
|
| 671 |
problems.append(f"run {agent}: its first prompt doesn't hold its own number")
|
| 672 |
+
report[agent] = {"saw": len(seen), "got_own": got_own, "board_reads": board_reads}
|
| 673 |
return problems, report
|
| 674 |
|
| 675 |
|
|
|
|
| 693 |
run = root / f"run-{len(list(root.iterdir()))}"
|
| 694 |
(run / "agents" / "_sessions").mkdir(parents=True)
|
| 695 |
(run / "run.json").write_text(json.dumps({"spec": {"types": {"agent": {"harbor": {
|
| 696 |
+
"config": {"task": {"selector": [f"{AUDIT_TEAM}-s01", f"{AUDIT_TEAM}-s02"]}}}}}}}))
|
| 697 |
board = run / "agents" / "_harbor" / "_worker" / "resources" / "message_board"
|
| 698 |
board.mkdir(parents=True)
|
| 699 |
lines = [f"{who}: my number is {g.words(number)} ({number})"
|