check.py: the Flock-run audit counts numbers in digits too (the JSON answer, mappings, stated numbers), with synthetic leak cases; setaside.py names memory and Trial failures
Browse files- README.md +7 -1
- check.py +151 -21
- flock/sweep/setaside.py +8 -0
README.md
CHANGED
|
@@ -233,7 +233,13 @@ uv run check.py --env none --run RUN_DIR # also a Flock run of a team (below)
|
|
| 233 |
agent's first prompt (the task's instruction and Flock's) holds no number of the team; the
|
| 234 |
first tool output in which an agent sees a teammate's number is a board read, after that
|
| 235 |
teammate posted it; the first post holding each number is its owner's; and each agent read
|
| 236 |
-
its own number from its environment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
`--env` takes a Harbor environment type or an import path. Harbor 0.25.0's `hf-sandbox` uploads
|
| 239 |
`tests/` with the host's file owner, which a sandbox can't take when the host's uid is over
|
|
|
|
| 233 |
agent's first prompt (the task's instruction and Flock's) holds no number of the team; the
|
| 234 |
first tool output in which an agent sees a teammate's number is a board read, after that
|
| 235 |
teammate posted it; the first post holding each number is its owner's; and each agent read
|
| 236 |
+
its own number from its environment. A number counts in words and in digits where they read
|
| 237 |
+
as a held number: an array of the team's integers (the JSON answer, or part of it), an
|
| 238 |
+
agent's number in a mapping (`"agent-002": 26`) or a stated number (`number is 26`); bare
|
| 239 |
+
ids, counts and timestamps don't. The audit itself runs on synthetic runs every time: a
|
| 240 |
+
clean one, and one whose ids and timestamps hold the team's numbers, pass; words, the JSON
|
| 241 |
+
answer, a mapping or a stated number in the first prompt or in a non-board output before the
|
| 242 |
+
board fail, and so does a number first posted by an agent that doesn't hold it.
|
| 243 |
|
| 244 |
`--env` takes a Harbor environment type or an import path. Harbor 0.25.0's `hf-sandbox` uploads
|
| 245 |
`tests/` with the host's file owner, which a sandbox can't take when the host's uid is over
|
check.py
CHANGED
|
@@ -51,7 +51,14 @@
|
|
| 51 |
the board export): no system prompt or first prompt holds a number of the team; the first
|
| 52 |
output in which an agent sees a teammate's number is a board read, or a later prompt (a
|
| 53 |
wake-up quoting the board); the first post holding each number is its owner's; and each
|
| 54 |
-
agent read its own number outside the board.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
"""
|
| 56 |
|
| 57 |
import argparse
|
|
@@ -65,6 +72,7 @@ import shutil
|
|
| 65 |
import subprocess
|
| 66 |
import sys
|
| 67 |
import tempfile
|
|
|
|
| 68 |
from pathlib import Path
|
| 69 |
|
| 70 |
HERE = Path(__file__).resolve().parent
|
|
@@ -607,34 +615,63 @@ def texts(message: dict) -> str:
|
|
| 607 |
if isinstance(part, dict))
|
| 608 |
|
| 609 |
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
agent
|
| 613 |
-
|
| 614 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
spec = json.loads((run / "run.json").read_text())["spec"]
|
| 616 |
harbor = next(t["harbor"] for t in spec["types"].values() if t.get("harbor"))
|
| 617 |
task = harbor["config"]["task"]["selector"]
|
| 618 |
team = json.loads((HERE / NUMBERS_JSON).read_text())[task]
|
| 619 |
-
|
| 620 |
boards = sorted(run.rglob("resources/message_board/board.jsonl"))
|
| 621 |
-
|
|
|
|
| 622 |
posts = sorted((json.loads(x)["message"] for b in boards[:1]
|
| 623 |
for x in b.read_text().splitlines() if x.strip()),
|
| 624 |
key=lambda m: m["created_at"])
|
| 625 |
first = {}
|
| 626 |
for post in posts:
|
| 627 |
-
for
|
| 628 |
-
first.setdefault(
|
| 629 |
-
for
|
| 630 |
-
|
|
|
|
| 631 |
report = {"task": task, "posts": len(posts), "first_posts": first}
|
| 632 |
for agent, own in team.items():
|
| 633 |
path = run / "agents" / "_sessions" / f"{agent}.jsonl"
|
| 634 |
if not path.is_file():
|
| 635 |
-
|
| 636 |
continue
|
| 637 |
-
others
|
|
|
|
| 638 |
for line in path.read_text().splitlines():
|
| 639 |
event = json.loads(line) if line.strip() else {}
|
| 640 |
message = event.get("message") or {}
|
|
@@ -647,23 +684,112 @@ def check_run(run: Path) -> dict:
|
|
| 647 |
calls[part.get("id")] = json.dumps(part.get("arguments") or {})
|
| 648 |
elif role in ("system", "user"):
|
| 649 |
if role == "system" or prompts == 0: # what Flock and the task tell the agent
|
| 650 |
-
|
| 651 |
-
|
| 652 |
else: # a later prompt may quote the board (a wake-up on a mention)
|
| 653 |
-
seen |=
|
| 654 |
prompts += role == "user"
|
| 655 |
elif role == "toolResult":
|
| 656 |
command = calls.get(message.get("toolCallId"), "")
|
| 657 |
-
new =
|
| 658 |
-
|
| 659 |
-
|
|
|
|
| 660 |
seen |= new
|
| 661 |
read_own |= own in holds(text, {own}) and "message_board" not in command
|
| 662 |
-
|
|
|
|
| 663 |
report[agent] = {"saw": len(seen), "read_own": read_own}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
return report
|
| 665 |
|
| 666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
def main() -> int:
|
| 668 |
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 669 |
parser.add_argument("--env", default="hf-sandbox",
|
|
@@ -692,6 +818,10 @@ def main() -> int:
|
|
| 692 |
report = asyncio.run(check_trials(args.env, jobs))
|
| 693 |
print(f"5. no-cheat (Trials on {args.env}, {PROBE_TASK}): {len(failures) - before} "
|
| 694 |
f"failures; {json.dumps(report)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 695 |
for run in args.run:
|
| 696 |
before = len(failures)
|
| 697 |
report = check_run(run)
|
|
|
|
| 51 |
the board export): no system prompt or first prompt holds a number of the team; the first
|
| 52 |
output in which an agent sees a teammate's number is a board read, or a later prompt (a
|
| 53 |
wake-up quoting the board); the first post holding each number is its owner's; and each
|
| 54 |
+
agent read its own number outside the board. A number counts in words ("twenty-six") and in
|
| 55 |
+
digits where they read as a held number: an array of the team's integers (the JSON answer,
|
| 56 |
+
or part of it), an agent's number in a mapping (`"agent-002": 26`) and a stated number
|
| 57 |
+
(`number is 26`); bare ids, counts and timestamps don't. The audit itself is checked on
|
| 58 |
+
synthetic runs, always: a clean one and one whose ids and timestamps hold the team's numbers
|
| 59 |
+
pass, and each leak fails (words, the JSON answer, a mapping and a stated number, in the first
|
| 60 |
+
prompt or in a non-board output before the board, and a number first posted by an agent that
|
| 61 |
+
doesn't hold it).
|
| 62 |
"""
|
| 63 |
|
| 64 |
import argparse
|
|
|
|
| 72 |
import subprocess
|
| 73 |
import sys
|
| 74 |
import tempfile
|
| 75 |
+
from collections import Counter
|
| 76 |
from pathlib import Path
|
| 77 |
|
| 78 |
HERE = Path(__file__).resolve().parent
|
|
|
|
| 615 |
if isinstance(part, dict))
|
| 616 |
|
| 617 |
|
| 618 |
+
ARRAY = re.compile(r"\[\s*\d{1,2}(?:\s*,\s*\d{1,2})+\s*\]")
|
| 619 |
+
STATED = ( # digits that read as a number someone holds; bare ids, counts and timestamps don't
|
| 620 |
+
re.compile(r"agent-\d{3}[\"']?\s*[:=]\s*[\"']?(\d{1,2})(?![\d.:])"), # "agent-002": 26
|
| 621 |
+
re.compile(r"\bnumbers?\b(?:\s+(?:is|are|was|were)|:|=)?\s*[\"']?(\d{1,2})(?![\d.:])",
|
| 622 |
+
re.IGNORECASE), # number is 26
|
| 623 |
+
)
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
def given_away(text: str, team: dict[str, str]) -> set[int]:
|
| 627 |
+
"""The team's numbers that `text` holds: as words ("twenty-six"), or as digits where they
|
| 628 |
+
read as a held number: an array of the team's integers (a whole or partial answer, e.g.
|
| 629 |
+
`[15, 26, 37]`), an agent's number in a mapping or a line (`"agent-002": 26`), or a number
|
| 630 |
+
stated as one (`number is 26`, `numbers: 15`)."""
|
| 631 |
+
values = Counter(read_words(w) for w in team.values())
|
| 632 |
+
out = {read_words(w) for w in holds(text, set(team.values()))}
|
| 633 |
+
for array in ARRAY.findall(text):
|
| 634 |
+
numbers = Counter(int(x) for x in re.findall(r"\d+", array))
|
| 635 |
+
if not numbers - values: # all of them the team's
|
| 636 |
+
out |= set(numbers)
|
| 637 |
+
for pattern in STATED:
|
| 638 |
+
out |= {int(x) for x in pattern.findall(text)} & set(values)
|
| 639 |
+
return out
|
| 640 |
+
|
| 641 |
+
|
| 642 |
+
def audit_run(run: Path) -> tuple[list[str], dict]:
|
| 643 |
+
"""(problems, report) for a Flock run of one team (a local run's `.flock/<swarm>-<time>/`):
|
| 644 |
+
no prompt Flock gave an agent holds a number of the team; the first output in which an agent
|
| 645 |
+
sees a teammate's number is a board read (or a wake-up that quotes the board), and the first
|
| 646 |
+
post holding each number is its owner's; each agent read its own number from its
|
| 647 |
+
environment. A number counts as words or as digits (given_away)."""
|
| 648 |
+
problems = []
|
| 649 |
spec = json.loads((run / "run.json").read_text())["spec"]
|
| 650 |
harbor = next(t["harbor"] for t in spec["types"].values() if t.get("harbor"))
|
| 651 |
task = harbor["config"]["task"]["selector"]
|
| 652 |
team = json.loads((HERE / NUMBERS_JSON).read_text())[task]
|
| 653 |
+
held = {agent: read_words(word) for agent, word in team.items()}
|
| 654 |
boards = sorted(run.rglob("resources/message_board/board.jsonl"))
|
| 655 |
+
if len(boards) != 1:
|
| 656 |
+
problems.append(f"run {run.name}: {len(boards)} board exports")
|
| 657 |
posts = sorted((json.loads(x)["message"] for b in boards[:1]
|
| 658 |
for x in b.read_text().splitlines() if x.strip()),
|
| 659 |
key=lambda m: m["created_at"])
|
| 660 |
first = {}
|
| 661 |
for post in posts:
|
| 662 |
+
for number in given_away(post["body"], team):
|
| 663 |
+
first.setdefault(number, post["sender"]["external_id"])
|
| 664 |
+
for number, who in first.items():
|
| 665 |
+
if held.get(who) != number:
|
| 666 |
+
problems.append(f"run {run.name}: {number} was first posted by {who}")
|
| 667 |
report = {"task": task, "posts": len(posts), "first_posts": first}
|
| 668 |
for agent, own in team.items():
|
| 669 |
path = run / "agents" / "_sessions" / f"{agent}.jsonl"
|
| 670 |
if not path.is_file():
|
| 671 |
+
problems.append(f"run {run.name}: no event stream for {agent}")
|
| 672 |
continue
|
| 673 |
+
others = set(held.values()) - {held[agent]}
|
| 674 |
+
seen, calls, prompts, read_own = set(), {}, 0, False
|
| 675 |
for line in path.read_text().splitlines():
|
| 676 |
event = json.loads(line) if line.strip() else {}
|
| 677 |
message = event.get("message") or {}
|
|
|
|
| 684 |
calls[part.get("id")] = json.dumps(part.get("arguments") or {})
|
| 685 |
elif role in ("system", "user"):
|
| 686 |
if role == "system" or prompts == 0: # what Flock and the task tell the agent
|
| 687 |
+
if given := given_away(text, team):
|
| 688 |
+
problems.append(f"run {agent}: its {role} prompt holds {sorted(given)}")
|
| 689 |
else: # a later prompt may quote the board (a wake-up on a mention)
|
| 690 |
+
seen |= given_away(text, team) & others
|
| 691 |
prompts += role == "user"
|
| 692 |
elif role == "toolResult":
|
| 693 |
command = calls.get(message.get("toolCallId"), "")
|
| 694 |
+
new = given_away(text, team) & others - seen
|
| 695 |
+
if new and "message_board" not in command:
|
| 696 |
+
problems.append(f"run {agent}: first saw {sorted(new)} in the output of "
|
| 697 |
+
f"{command[:120]}")
|
| 698 |
seen |= new
|
| 699 |
read_own |= own in holds(text, {own}) and "message_board" not in command
|
| 700 |
+
if not read_own:
|
| 701 |
+
problems.append(f"run {agent}: never read its own number")
|
| 702 |
report[agent] = {"saw": len(seen), "read_own": read_own}
|
| 703 |
+
return problems, report
|
| 704 |
+
|
| 705 |
+
|
| 706 |
+
def check_run(run: Path) -> dict:
|
| 707 |
+
problems, report = audit_run(run)
|
| 708 |
+
failures.extend(problems)
|
| 709 |
return report
|
| 710 |
|
| 711 |
|
| 712 |
+
AUDIT_TEAM = "agg-p01-n04"
|
| 713 |
+
|
| 714 |
+
|
| 715 |
+
def synthetic_run(root: Path, prompt: str = "", output: str = "",
|
| 716 |
+
poster: dict | None = None) -> Path:
|
| 717 |
+
"""A local run directory of AUDIT_TEAM as Flock leaves it, whose agents behave: each reads
|
| 718 |
+
its number, posts it, reads the board. `prompt` joins agent-001's first prompt, `output` is
|
| 719 |
+
a non-board command's output it gets before it reads the board, and `poster` posts a number
|
| 720 |
+
in another agent's name first (agent -> number)."""
|
| 721 |
+
team = json.loads((HERE / NUMBERS_JSON).read_text())[AUDIT_TEAM]
|
| 722 |
+
run = root / f"run-{len(list(root.iterdir()))}"
|
| 723 |
+
(run / "agents" / "_sessions").mkdir(parents=True)
|
| 724 |
+
(run / "run.json").write_text(json.dumps({"spec": {"types": {"agent": {"harbor": {
|
| 725 |
+
"config": {"task": {"selector": AUDIT_TEAM}}}}}}}))
|
| 726 |
+
board = run / "agents" / "_harbor" / "_worker" / "resources" / "message_board"
|
| 727 |
+
board.mkdir(parents=True)
|
| 728 |
+
lines = [f"{who}: my number is {g.words(number)} ({number})"
|
| 729 |
+
for who, number in (poster or {}).items()]
|
| 730 |
+
lines += [f"{agent}: my number is {word} ({read_words(word)})" for agent, word in team.items()]
|
| 731 |
+
senders = [*(poster or {}), *team]
|
| 732 |
+
board_lines = [json.dumps({"channel_id": 1, "message": {
|
| 733 |
+
"seq": k, "created_at": 1000.0 + k, "body": body, "sender": {"external_id": who}}})
|
| 734 |
+
for k, (who, body) in enumerate(zip(senders, lines, strict=True), 1)]
|
| 735 |
+
(board / "board.jsonl").write_text("\n".join(board_lines) + "\n")
|
| 736 |
+
instruction = (HERE / "tasks" / AUDIT_TEAM / "instruction.md").read_text()
|
| 737 |
+
|
| 738 |
+
def message(role, content, **extra):
|
| 739 |
+
return json.dumps({"type": "message", "message": {"role": role, "content": content,
|
| 740 |
+
**extra}})
|
| 741 |
+
|
| 742 |
+
def call(k, command):
|
| 743 |
+
return message("assistant", [{"type": "toolCall", "id": f"c{k}",
|
| 744 |
+
"arguments": {"command": command}}])
|
| 745 |
+
|
| 746 |
+
def result(k, text):
|
| 747 |
+
return message("toolResult", [{"type": "text", "text": text}], toolCallId=f"c{k}")
|
| 748 |
+
|
| 749 |
+
for agent, word in team.items():
|
| 750 |
+
events = [message("system", [{"type": "text", "text": "You are Pi."}]),
|
| 751 |
+
message("user", [{"type": "text", "text": instruction + (
|
| 752 |
+
prompt if agent == "agent-001" else "")}]),
|
| 753 |
+
call(1, "echo $PRIVATE_NUMBER"), result(1, word)]
|
| 754 |
+
if agent == "agent-001" and output:
|
| 755 |
+
events += [call(2, "cat /tmp/notes.json"), result(2, output)]
|
| 756 |
+
events += [call(3, "flock-tool message_board.read --json '{}'"),
|
| 757 |
+
result(3, json.dumps({"messages": lines}))]
|
| 758 |
+
(run / "agents" / "_sessions" / f"{agent}.jsonl").write_text("\n".join(events) + "\n")
|
| 759 |
+
return run
|
| 760 |
+
|
| 761 |
+
|
| 762 |
+
def check_audit() -> int:
|
| 763 |
+
"""audit_run on synthetic runs: a clean one passes, ids and timestamps that happen to be
|
| 764 |
+
the team's numbers pass, and each leak fails: words, the JSON answer, a mapping and a stated
|
| 765 |
+
number, in the first prompt or a non-board output before the board; and a number first
|
| 766 |
+
posted by an agent that doesn't hold it. Returns the cases checked."""
|
| 767 |
+
team = json.loads((HERE / NUMBERS_JSON).read_text())[AUDIT_TEAM]
|
| 768 |
+
numbers = [read_words(w) for w in team.values()] # agent-001's first
|
| 769 |
+
answer = json.dumps(sorted(numbers))
|
| 770 |
+
mapping = json.dumps({a: read_words(w) for a, w in team.items()})
|
| 771 |
+
noise = json.dumps({"id": numbers[1], "seq": numbers[2], "count": numbers[3],
|
| 772 |
+
"created_at": f"2026-11-16T{numbers[2]:02d}:{numbers[3]:02d}:00Z"})
|
| 773 |
+
cases = {
|
| 774 |
+
"clean": ({}, False),
|
| 775 |
+
"ids, counts and a timestamp that hold the numbers": ({"output": noise}, False),
|
| 776 |
+
"a teammate's number in words in the first prompt": (
|
| 777 |
+
{"prompt": f"\nagent-002 holds {team['agent-002']}."}, True),
|
| 778 |
+
"the JSON answer in the first prompt": ({"prompt": f"\nThe answer is {answer}."}, True),
|
| 779 |
+
"the JSON answer in a non-board output": ({"output": answer}, True),
|
| 780 |
+
"a mapping of agents to numbers in a non-board output": ({"output": mapping}, True),
|
| 781 |
+
"a teammate's number stated in digits in a non-board output": (
|
| 782 |
+
{"output": f"agent-003's number is {numbers[2]}"}, True),
|
| 783 |
+
"a number first posted by an agent that doesn't hold it": (
|
| 784 |
+
{"poster": {"agent-001": numbers[1]}}, True),
|
| 785 |
+
}
|
| 786 |
+
with tempfile.TemporaryDirectory() as d:
|
| 787 |
+
for case, (kwargs, leaks) in cases.items():
|
| 788 |
+
problems, _ = audit_run(synthetic_run(Path(d), **kwargs))
|
| 789 |
+
check(bool(problems) == leaks, f"audit: {case}: {problems or 'no problem found'}")
|
| 790 |
+
return len(cases)
|
| 791 |
+
|
| 792 |
+
|
| 793 |
def main() -> int:
|
| 794 |
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
| 795 |
parser.add_argument("--env", default="hf-sandbox",
|
|
|
|
| 818 |
report = asyncio.run(check_trials(args.env, jobs))
|
| 819 |
print(f"5. no-cheat (Trials on {args.env}, {PROBE_TASK}): {len(failures) - before} "
|
| 820 |
f"failures; {json.dumps(report)}")
|
| 821 |
+
before = len(failures)
|
| 822 |
+
cases = check_audit()
|
| 823 |
+
print(f"6. no-cheat (the Flock-run audit on {cases} synthetic runs): "
|
| 824 |
+
f"{len(failures) - before} failures")
|
| 825 |
for run in args.run:
|
| 826 |
before = len(failures)
|
| 827 |
report = check_run(run)
|
flock/sweep/setaside.py
CHANGED
|
@@ -5,10 +5,12 @@ reason uses them all. Writes `<root>/setaside.md`; the reasons, first that appli
|
|
| 5 |
|
| 6 |
- the worker was relaunched (more than one incarnation: flock#121's case) after it ran out of memory
|
| 7 |
(the worker's memory ladder rotated or preempted it), or else after a node failure;
|
|
|
|
| 8 |
- the controller's node was reclaimed (spot) mid-run;
|
| 9 |
- the task image couldn't be pulled (Docker Hub's unauthenticated limit), so the Trials never
|
| 10 |
started;
|
| 11 |
- the verifier timed out (Harbor's 60 s) on a loaded worker;
|
|
|
|
| 12 |
- the run was cancelled before its Trials were graded (the driver stopped and its in-flight
|
| 13 |
teams cancelled, e.g. to switch the workers to the image mirror).
|
| 14 |
"""
|
|
@@ -33,9 +35,15 @@ def reason(row: dict, run_dir: Path) -> str:
|
|
| 33 |
return "controller's node reclaimed (spot)"
|
| 34 |
if "toomanyrequests" in workers:
|
| 35 |
return "task image not pulled (Docker Hub limit): Trials never started"
|
|
|
|
|
|
|
| 36 |
if any("VerifierTimeoutError" in p.read_text(errors="replace")
|
| 37 |
for p in run_dir.glob("results/*/agent-*/trials/*/result.json")):
|
| 38 |
return "verifier timed out (60 s) on a loaded worker"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return "cancelled before grading (driver stopped, in-flight teams cancelled)"
|
| 40 |
|
| 41 |
|
|
|
|
| 5 |
|
| 6 |
- the worker was relaunched (more than one incarnation: flock#121's case) after it ran out of memory
|
| 7 |
(the worker's memory ladder rotated or preempted it), or else after a node failure;
|
| 8 |
+
- the worker ran out of memory and was preempted or killed without a relaunch;
|
| 9 |
- the controller's node was reclaimed (spot) mid-run;
|
| 10 |
- the task image couldn't be pulled (Docker Hub's unauthenticated limit), so the Trials never
|
| 11 |
started;
|
| 12 |
- the verifier timed out (Harbor's 60 s) on a loaded worker;
|
| 13 |
+
- an agent's Trial failed before its verifier ran (e.g. flock's idle probe of the container);
|
| 14 |
- the run was cancelled before its Trials were graded (the driver stopped and its in-flight
|
| 15 |
teams cancelled, e.g. to switch the workers to the image mirror).
|
| 16 |
"""
|
|
|
|
| 35 |
return "controller's node reclaimed (spot)"
|
| 36 |
if "toomanyrequests" in workers:
|
| 37 |
return "task image not pulled (Docker Hub limit): Trials never started"
|
| 38 |
+
if re.search(r"preempted \(memory\)|oom_kill", workers):
|
| 39 |
+
return "worker ran out of memory (preempted or killed, not relaunched)"
|
| 40 |
if any("VerifierTimeoutError" in p.read_text(errors="replace")
|
| 41 |
for p in run_dir.glob("results/*/agent-*/trials/*/result.json")):
|
| 42 |
return "verifier timed out (60 s) on a loaded worker"
|
| 43 |
+
failed = [(json.loads(p.read_text()).get("exception_info") or {}).get("exception_type")
|
| 44 |
+
for p in run_dir.glob("results/*/agent-*/trials/*/result.json")]
|
| 45 |
+
if kinds := sorted({k for k in failed if k and k != "CancelledError"}): # cancelled: below
|
| 46 |
+
return f"an agent's Trial failed before its verifier ran ({', '.join(kinds)})"
|
| 47 |
return "cancelled before grading (driver stopped, in-flight teams cancelled)"
|
| 48 |
|
| 49 |
|